1.1.0 • Published 3 years ago

rn-google-api-availability v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

npm install --save rn-google-api-availability
yarn add rn-google-api-availability

Requires React Native >= 0.47

Usage

import GoogleAPIAvailability from 'rn-google-api-availability';

GoogleAPIAvailability.checkGooglePlayServices((result) => {
	if(result === 'update') {
		GoogleAPIAvailability.promptGooglePlayUpdate(false);
	}
});
<View>
	<Text>Please update Google Play Services to view map</Text>
	<TouchableHighlight onPress={() => GoogleAPIAvailability.openGooglePlayUpdate()}>
		<Text>Update</Text>
	</TouchableHighlight>
</View>

Methods

Method NameArgumentsNotes
checkGooglePlayServicesresult-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.
promptGooglePlayUpdateallowUse-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
openGooglePlayUpdatenone-Opens Google Play Services in the Play Store application

TODO

  • Add Example App
  • Expose more API functions