Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app getting crash after google login process #133

Open
kapil9-10 opened this issue Sep 3, 2020 · 0 comments
Open

app getting crash after google login process #133

kapil9-10 opened this issue Sep 3, 2020 · 0 comments

Comments

@kapil9-10
Copy link

kapil9-10 commented Sep 3, 2020

I m using angular9

first time it worked fine but next day it start throwing error .. crashing the app

in Android XMl i added

<intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Custom URL Schemes -->
            <data android:path="/auth" android:scheme="com.googleusercontent.apps.800571902932-r8c3lu7vv592qfjfiibg9gcga5ssmnab"/>
        </intent-filter>

in AuthService

export class AuthServiceService {
client: TnsOAuthClient
constructor() {
console.log('auth Service Called')
this.configureOAuthProviders()
}

configureOAuthProviders() {
    const googleProvider = this.configureOAuthProviderGoogle();
    const facebookProvider=this.configureOAuthProviderFacebook();
    configureTnsOAuth([googleProvider,facebookProvider])
}

configureOAuthProviderGoogle() {
    const googleProviderOptions: TnsOaProviderOptionsGoogle = {
        openIdSupport: 'oid-full',
        clientId: '800571902932-r8c3lu7vv592qfjfiibg9gcga5ssmnab.apps.googleusercontent.com',
        redirectUri: 'com.googleusercontent.apps.800571902932-r8c3lu7vv592qfjfiibg9gcga5ssmnab:/auth',
        urlScheme: 'com.googleusercontent.apps.800571902932-r8c3lu7vv592qfjfiibg9gcga5ssmnab',
        scopes: ['email']
    }
    const googleProvider = new TnsOaProviderGoogle(googleProviderOptions)
    return googleProvider
}

configureOAuthProviderFacebook(): TnsOaProvider {
    const facebookProviderOptions: TnsOaProviderOptionsFacebook = {
      openIdSupport: "oid-none",
      clientId: "780290375855498",
      clientSecret: "1f906742a2dad8df90003f78b0e5080e",
      redirectUri: "https://www.facebook.com/connect/login_success.html",
      scopes: ["email"]
    };
    const facebookProvider = new TnsOaProviderFacebook(facebookProviderOptions);
    return facebookProvider;
  }

functionTnsOauthLogin(providerType) {
    this.client = new TnsOAuthClient(providerType);

    this.client.loginWithCompletion((TokenResult: ITnsOAuthTokenResult, error) => {
        if (error) {
            console.log(error)
        } else {
            console.log(TokenResult)
        }
    })
}

}

on tap event i m calling the method
JS: topmost() is deprecated. Use Frame.topmost() instead.
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to destroy activity {org.nativescript.TravelGo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onDestroy failed
System.err: Error: View not added to this instance. View: ProxyViewContainer(8) CurrentParent: Page(4) ExpectedParent: AppHostView(1)
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to destroy activity {org.nativescript.TravelGo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onDestroy failed
System.err: Error: View not added to this instance. View: ProxyViewContainer(8) CurrentParent: Page(4) ExpectedParent: AppHostView(1)
System.err: at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5012)
System.err: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5041)
System.err: at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
System.err: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:223)
System.err: at android.app.ActivityThread.main(ActivityThread.java:7523)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onDestroy failed
System.err: Error: View not added to this instance. View: ProxyViewContainer(8) CurrentParent: Page(4) ExpectedParent: AppHostView(1)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err: at com.tns.NativeScriptActivity.onDestroy(NativeScriptActivity.java:39)
System.err: at android.app.Activity.performDestroy(Activity.java:8229)
System.err: at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344)
System.err: at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4997)
System.err: ... 11 more

package.json

{
"nativescript": {
"id": "org.nativescript.TravelGo",
"tns-android": {
"version": "6.5.1"
},
"tns-ios": {
"version": "6.5.1"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"repository": "",
"scripts": {
"ngcc": "ngcc --properties es2015 module main --first-only",
"postinstall": "npm run ngcc"
},
"dependencies": {
"@angular/animations": "~9.1.0",
"@angular/common": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/core": "~9.1.0",
"@angular/forms": "~9.1.0",
"@angular/platform-browser": "~9.1.0",
"@angular/platform-browser-dynamic": "~9.1.0",
"@angular/router": "~9.1.0",
"@nativescript/angular": "~9.0.0",
"@nativescript/theme": "~2.3.0",
"@nstudio/nativescript-checkbox": "^1.0.0",
"nativescript-intl": "^4.0.1",
"nativescript-oauth2": "^2.4.3",
"nativescript-ui-dataform": "^6.1.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.5.0",
"tns-core-modules": "~6.5.0",
"validator": "^13.1.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular/compiler-cli": "~9.1.0",
"@nativescript/schematics": "^9.0.0",
"@ngtools/webpack": "~9.1.0",
"nativescript-dev-webpack": "~1.5.0",
"tns-platform-declarations": "~6.5.0",
"typescript": "~3.8.3"
},
"readme": "NativeScript Application"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant