Unique ID of MAUI device

Wheelstring 190 Reputation points
2025-02-20T10:00:22.5+00:00

Hello IT gurus

I need some unique identifier of MAUI device (platforms: iPhone/Windows/Android/Tizen/MacCatalyst...) like MAC address of device, whatever...

I want answer on this question:

Is it the first (self) app instalation on this device? Yes/No (True/False)

I need solve situation: install(first)-uninstall-install(second)-uninstall-install(second..and..more..)

Thank for ideas, hints!

W

Tags: MAUI, iOS, Windows, Android, C#, MacOS, Tizen, App publishing

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,942 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 71,686 Reputation points
    2025-02-21T04:10:36.5333333+00:00

    this is the standard code:

    #if ANDROID
        string deviceID = Android.Provider.Settings.Secure.GetString(Platform.CurrentActivity.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
     
    #elif IOS
        string deviceID = UIKit.UIDevice.CurrentDevice.IdentifierForVendor.ToString();
    #endif
    

    the android id is assigned when the device is first booted, and should remain for the life of the device.

    apple is more privacy conscious, so the IOS version does not support your requirement. it is generated when your app is installed, and shared among your apps, but if they are all removed, then the id is removed. a new install will result in a new id.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.