NativeScript / plugins

@nativescript plugins to help with your developments.
https://docs.nativescript.org/plugins/index.html
Apache License 2.0
189 stars 107 forks source link

@nativescript/google-signin Configure Placement #510

Open NicholasSmilovic opened 1 year ago

NicholasSmilovic commented 1 year ago

From the comment and past experiences I figured the configure method needed to be called in main.ts. https://github.com/NativeScript/plugins/issues/492#issuecomment-1547155963

Also be sure you have called configure in main.ts (or app.ts depending on project type), eg:

import { GoogleSignin } from '@nativescript/google-signin';

GoogleSignin.configure();

This results in a error GoogleSignin configuration error: Error: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter activity

and a GoogleSignin.signIn() error of .signIn Error: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData(android.content.Context)' on a null object reference

Putting the configure in a component or service after main.ts, still ensuring it's called only once, fixes this but it conflicts with @NathanWalker's recommendation

Examples made from ns create example-app --ng: https://github.com/NicholasSmilovic/nativescript-google-signin-demo -> master broken https://github.com/NicholasSmilovic/nativescript-google-signin-demo/pull/1 -> working