Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Check if user has google play services installed + updated from React Native, Android only
<https://developers.google.com/android/reference/com/google/android/gms/common/GoogleApiAvailability.html>

##Installation
## Installation
```
npm install --save react-native-google-api-availability-bridge
react-native link
```

Requires >= 0.32 RN

##Usage
## Usage
```js
const GoogleAPIAvailability = require('react-native-google-api-availability-bridge');

Expand All @@ -30,13 +30,15 @@ GoogleAPIAvailability.checkGooglePlayServices((result) => {
</View>
```

###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
* Expose more API functions
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -94,4 +97,4 @@ private void openPlayStore() {
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
reactContext.startActivity(intent);
}
}
}