Skip to content

Instantly share code, notes, and snippets.

@kiwipiet
Created July 26, 2016 21:15
Show Gist options
  • Save kiwipiet/1155660ae89de5c07df7f0ff89979e93 to your computer and use it in GitHub Desktop.
Save kiwipiet/1155660ae89de5c07df7f0ff89979e93 to your computer and use it in GitHub Desktop.
GoogleServices.IsGoogleServicesAvailable
using System;
using Android.Content;
using Android.Gms.Common;
public static class GoogleServices
{
private static Context _context;
public static void Init(Context context)
{
_context = context;
}
public static bool IsGoogleServicesAvailable()
{
Ensure.Condition(_context != null, () => { throw new Exception("Make sure you have called GoogleServices.Init in MainActivity"); });
var resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(_context);
return resultCode == ConnectionResult.Success;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment