NativeScript / NativeScript/plugins

@nativescript/google-signin Configure Placement

Open
#510 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
206
Forks
123
Avg merge
2d 1h
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the main.ts/app.ts entry points and the @nativescript/google-signin configure and signIn calls described in the issue. Compare the broken example with the linked working pull request, then verify that configuring from the recommended entry point no longer produces the Android errors and signIn succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.