Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to identify android mobile device uniqueid in xamarin android in c#

For my application, i need to trace the users android device unique id, android devices will be give to the employees by the client and when they use that device open our application and type some code. we have to check whether request came from the devices of our employees then only we will open the app. If other people have this app in their phone even though app will not open. It's a requirement which client wants, i googled it a lot found few links. Tried this but not working

  public static String getDeviceAndroidID(Context context)
  {
      String android_id = Secure.getString(context.getContentResolver(),     Secure.ANDROID_ID);
      if(android_id != null)
          return android_id;
      else
          return "";
   }

tried this but not getting "context . getcontentresolver()" Need some assistance thanks.

like image 539
adla praveen Avatar asked Jul 28 '16 08:07

adla praveen


People also ask

How can you identify a uniquely mobile device?

This unique ID can be IMEI, MEID, ESN or IMSI. They can be defined as follows : IMEI for International Mobile Equipment Identity : the Unique Number to identify GSM, WCDMA mobile phones as well as some satellite phones.

How do I identify my Android phone?

Open your phone's dial pad, usually named “Phone” in the apps drawer. 2. Here dial this code *#*#8255#*#*. As soon as you will enter the last digit, Gtalk Service Monitor will open up and show your Android device ID along with your email.

How do I find my mobile device ID?

For other devices, like Android, go to Settings and select "System". Next, tap About Phone. Look for your IMEI number listed here or tap Status for more info.


1 Answers

Try the Android.Provider namespace:

var android_id = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);
like image 196
SushiHangover Avatar answered Oct 06 '22 01:10

SushiHangover