[utils][js][android] add `firebase.utils().getPlayServicesStatus(): Promise<GoogleApiAvailabilityType | null>` to retrieve the latest play services status. Fixes #1257
This commit is contained in:
parent
d65d9e405c
commit
f86163460d
|
@ -73,10 +73,15 @@ public class RNFirebaseModule extends ReactContextBaseJavaModule {
|
|||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getPlayServicesStatus(Promise promise) {
|
||||
promise.resolve(getPlayServicesStatusMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private WritableMap getPlayServicesStatus() {
|
||||
private WritableMap getPlayServicesStatusMap() {
|
||||
GoogleApiAvailability gapi = GoogleApiAvailability.getInstance();
|
||||
final int status = gapi.isGooglePlayServicesAvailable(getReactApplicationContext());
|
||||
WritableMap result = Arguments.createMap();
|
||||
|
@ -176,7 +181,7 @@ public class RNFirebaseModule extends ReactContextBaseJavaModule {
|
|||
}
|
||||
|
||||
constants.put("apps", appMapsList);
|
||||
constants.put("playServicesAvailability", getPlayServicesStatus());
|
||||
constants.put("playServicesAvailability", getPlayServicesStatusMap());
|
||||
return constants;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,11 @@ export default class RNFirebaseUtils extends ModuleBase {
|
|||
}
|
||||
}
|
||||
|
||||
getPlayServicesStatus(): Promise<GoogleApiAvailabilityType | null> {
|
||||
if (isIOS) return Promise.resolve(null);
|
||||
return FirebaseCoreModule.getPlayServicesStatus();
|
||||
}
|
||||
|
||||
promptForPlayServices() {
|
||||
if (isIOS) return null;
|
||||
return FirebaseCoreModule.promptForPlayServices();
|
||||
|
|
Loading…
Reference in New Issue