Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Created October 31, 2018 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/0ca3da8863f436c842f09481fad3b64a to your computer and use it in GitHub Desktop.
Save juucustodio/0ca3da8863f436c842f09481fad3b64a to your computer and use it in GitHub Desktop.
Example how your Xamarin.Forms application get the IMEI code from device - http://julianocustodio.com/imei
using Android.Telephony;
using DemoImei.Droid;
using Xamarin.Forms;
[assembly: Dependency(typeof(ServiceImei))]
namespace DemoImei.Droid
{
public class ServiceImei : IServiceImei
{
public string GetImei()
{
try
{
TelephonyManager manager = (TelephonyManager)Forms.Context.GetSystemService(Android.Content.Context.TelephonyService);
return manager.Imei;
}
catch
{
return null;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment