From f11ee844166cd85f70169aeb680448f5dde06a67 Mon Sep 17 00:00:00 2001 From: Ramesh Nair Date: Wed, 3 May 2017 15:21:43 +0100 Subject: [PATCH 1/2] Return status-specific results --- .../ReactNativeGooglePlayServicesModule.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/ivanwu/googleapiavailabilitybridge/ReactNativeGooglePlayServicesModule.java b/android/src/main/java/com/ivanwu/googleapiavailabilitybridge/ReactNativeGooglePlayServicesModule.java index 9032878..b1d66eb 100644 --- a/android/src/main/java/com/ivanwu/googleapiavailabilitybridge/ReactNativeGooglePlayServicesModule.java +++ b/android/src/main/java/com/ivanwu/googleapiavailabilitybridge/ReactNativeGooglePlayServicesModule.java @@ -75,10 +75,13 @@ private String checkGooglePlayServicesHelper() { final int googlePlayServicesCheck = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this.getCurrentActivity()); switch (googlePlayServicesCheck) { case ConnectionResult.SUCCESS: - return "success"; + return "success"; case ConnectionResult.SERVICE_DISABLED: + return "disabled"; case ConnectionResult.SERVICE_INVALID: + return "invalid"; case ConnectionResult.SERVICE_MISSING: + return "missing"; case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: return "update"; } @@ -94,4 +97,4 @@ private void openPlayStore() { intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); reactContext.startActivity(intent); } -} \ No newline at end of file +} From 0e79ea701f8148ed887d6668dcbc1d4f7614ec29 Mon Sep 17 00:00:00 2001 From: Ramesh Nair Date: Wed, 3 May 2017 15:24:21 +0100 Subject: [PATCH 2/2] Update README --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d653134..7e022bc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Check if user has google play services installed + updated from React Native, Android only -##Installation +## Installation ``` npm install --save react-native-google-api-availability-bridge react-native link @@ -10,7 +10,7 @@ react-native link Requires >= 0.32 RN -##Usage +## Usage ```js const GoogleAPIAvailability = require('react-native-google-api-availability-bridge'); @@ -30,13 +30,15 @@ GoogleAPIAvailability.checkGooglePlayServices((result) => { ``` -###Methods +### Methods + | Method Name | Arguments | Notes |---|---|---| -|`checkGooglePlayServices`|`result`|-Returns a promise with the Play Services status. `success` everything is good, `failure` if something goes wrong, `update` if Google Play Services are not on the latest version| +|`checkGooglePlayServices`|`result`|-Returns a promise with the Play Services status. `success` everything is good, `failure` if something goes wrong, `update` if services are not on the latest version, `missing` if services are missing, `invalid` if they are not setup correctly, `disabled` if services are disabled. | |`promptGooglePlayUpdate`|`allowUse`|-Brings a popup window prompting user to update their Play Services. -Accepts a boolean that can force quit the application if the user does not wish to update| |`openGooglePlayUpdate`|*none*|-Opens Google Play Services in the Play Store application| -##TODO +## TODO + * Add Example App -* Expose more API functions \ No newline at end of file +* Expose more API functions