Closed sean-browze closed 4 years ago
Hi @sean-browze ,
I can't reproduce with our sample project. Can you provide a list of:
cordova platform; cordova -v
@radixdev, thanks for the reply.
I cloned the sample repo and it's actually working fine so it seems it must be something on my end.
I don't have any possible customizations.
See below:
branch-cordova-sdk 3.2.0 "branch-cordova-sdk"
card.io.cordova.mobilesdk 2.1.0 "CardIO"
code-push 3.0.1 "CodePushAcquisition"
com.paypal.cordova.mobilesdk 3.5.0 "PayPalMobile"
cordova-plugin-advanced-http 2.2.0 "Advanced HTTP plugin"
cordova-plugin-appboy 2.12.0 "Device"
cordova-plugin-appsflyer-sdk 4.4.22 "AppsFlyer"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-code-push 1.12.0 "CodePush"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-facebook4 6.2.0 "Facebook Connect"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-googleplus 8.2.0 "Google SignIn"
cordova-plugin-inappbrowser 3.1.0 "InAppBrowser"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-keyboard 1.2.0 "Keyboard"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.6.0 "SocialSharing"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
es6-promise-plugin 4.2.2 "Promise"
Installed platforms:
android 8.0.0
ios 5.0.1
Available platforms:
browser ^6.0.0
electron ^1.0.0
osx ^5.0.0
windows ^7.0.0
9.0.0 (cordova-lib@9.0.1)
More logcat info:
Working sample app:
12-04 14:08:53.882 19283 19374 I Appboy v3.8.0 .com.appboy.Appboy: Firebase Cloud Messaging found. Setting up Firebase Cloud Messaging.
12-04 14:08:53.882 19283 19374 V Appboy v3.8.0 .bo.app.bs: Registering for Firebase Cloud Messaging token using sender id:[SENDER_ID]
12-04 14:08:53.883 19283 19377 I Appboy v3.8.0 .com.appboy.configuration.AppboyConfigurationProvider: Found an override api key. Using it to configure Appboy.
12-04 14:08:53.888 19283 19374 V Appboy v3.8.0 .bo.app.bs: Obtained Firebase Cloud Messaging token: [TOKEN]
12-04 14:08:53.888 19283 19374 I Appboy v3.8.0 .com.appboy.Appboy: Push token [TOKEN] registered and immediately being flushed.
My app:
12-04 14:15:50.470 22237 22456 I Appboy v3.8.0 .com.appboy.Appboy: Firebase Cloud Messaging found. Setting up Firebase Cloud Messaging.
12-04 14:15:50.470 22237 22456 V Appboy v3.8.0 .bo.app.bs: Registering for Firebase Cloud Messaging token using sender id: [SENDER_ID]
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: Failed to register for Firebase Cloud Messaging using sender ID: [SENDER_ID]
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process [APP_NAME]. Make sure to call FirebaseApp.initializeApp(Context) first.
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.1.0:245)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:1)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at bo.app.bs.b(SourceFile:107)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at bo.app.bs.a(SourceFile:42)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at com.appboy.Appboy$12.run(SourceFile:249)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-04 14:15:50.486 22237 22456 E Appboy v3.8.0 .bo.app.bs: at java.lang.Thread.run(Thread.java:764)
12-04 14:15:50.486 22237 22456 W Appboy v3.8.0 .bo.app.bs: Obtained an empty or null Firebase Cloud Messaging registration token. Not registering token.
Could another plugin be breaking this? Any ideas on what I could look into?
Another interesting thing to note is that when I run cordova run android
on the working sample app, it parses google-services.json
Task :app:processDebugGoogleServices
Parsing json file: /Docs/appboy-cordova-sdk/sample-project/platforms/android/app/google-services.json
This doesn't happen when I run cordova run android
on the broken app. It doesn't even look for google-services.json
.
@sean-browze good find, you should ensure google-services.json
is in a valid location per https://developers.google.com/android/guides/google-services-plugin
@Bucimis, thanks for the link. I figured this might have something to do with it. Any idea why the sample app will fail when building if I don't have the google-services.json
file in the correct location but my current app doesn't even check if it exists? Not sure what else to do to try to my app to pick up the file. I figured it should automatically try when classpath 'com.google.gms:google-services:4.3.3'
is dropped in.
@sean-browze you also need to add apply plugin: 'com.google.gms.google-services'
. Could also be a gradle build plugin version difference
@Bucimis you led me on the right path, thanks! It's working now. Not sure why, but I need to take these additional steps to get it to work:
classpath 'com.google.gms:google-services:4.3.3'
to the base build.gradle
fileapply plugin: 'com.google.gms.google-services'
to the bottom of app/build.gradle
Any idea why this isn't working out of the box for me?
@sean-browze typically our build-extras.gradle
file which contains relevant apply
and classpath
statements is included automatically via https://github.com/Appboy/appboy-cordova-sdk/blob/master/plugin.xml#L21 - so I would check if the extra gradle file is actually referenced by your project.
Regardless, as long as the google services plugin is available you should be in good shape. It doesn't matter whether it's included by you or by the Braze plugin
Seem to be having an issue with getting tokens registered on Android. Here is my logcat output:
I'm assuming it might have something to do with:
I've read through the documentation several times and I've gone through another app of ours that has no problem registering token and receiving push notifications. Not sure what the issue might be but would appreciate any guidance.
I should add, changeUser and event logging are working fine.