Created
July 26, 2016 21:15
-
-
Save kiwipiet/1155660ae89de5c07df7f0ff89979e93 to your computer and use it in GitHub Desktop.
GoogleServices.IsGoogleServicesAvailable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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