Hello,
You can get Device Id by Android.Provider.Settings.Secure
for Android and UIKit.UIDevice.CurrentDevice.IdentifierForVendor
for iOS.
If you want to invoke it in the MAUI directly, please use Conditional compilation
You can refer to the following 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
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.