Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit afc594b

Browse files
Using Firebase Firestore in a Nativescript Worker thread #1238
1 parent 5cd2a65 commit afc594b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/firebase.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,14 @@ firebase.getRemoteConfigDefaults = properties => {
511511
};
512512

513513
firebase._isGooglePlayServicesAvailable = () => {
514-
const activity = appModule.android.foregroundActivity || appModule.android.startActivity;
514+
const ctx = appModule.android.foregroundActivity || appModule.android.startActivity || com.tns.NativeScriptApplication.getInstance();
515515
const googleApiAvailability = com.google.android.gms.common.GoogleApiAvailability.getInstance();
516516
const playServiceStatusSuccess = 0; // com.google.android.gms.common.ConnectionResult.SUCCESS;
517-
const playServicesStatus = googleApiAvailability.isGooglePlayServicesAvailable(activity);
517+
const playServicesStatus = googleApiAvailability.isGooglePlayServicesAvailable(ctx);
518518
const available = playServicesStatus === playServiceStatusSuccess;
519519
if (!available && googleApiAvailability.isUserResolvableError(playServicesStatus)) {
520520
// show a dialog offering the user to update (no need to wait for it to finish)
521-
googleApiAvailability.showErrorDialogFragment(activity, playServicesStatus, 1, new android.content.DialogInterface.OnCancelListener({
521+
googleApiAvailability.showErrorDialogFragment(ctx, playServicesStatus, 1, new android.content.DialogInterface.OnCancelListener({
522522
onCancel: dialogInterface => {
523523
console.log("Canceled");
524524
}

0 commit comments

Comments
 (0)