CatalystCode / react-native-azurenotificationhub

React Native module to support Azure Notification Hub push notifications on Android, iOS, and Windows.
MIT License
47 stars 75 forks source link

Device not getting registered with Azure on Android #15

Closed kcfgl closed 7 years ago

kcfgl commented 7 years ago

Hey guys. Thanks for the hard work on this, it couldn't have come at a better time. All good on Windows (thank you!) and now implementing on Android. I followed the installation guide, app builds, no JS errors, double-checked everything looks good. Connection strings match Win and iOS, which all register perfectly.

But I'm not getting my device registered in the Azure notification hub (viewing registered devices in the portal) and my generic test messages are obviously not sending either.

Any gotchas not mentioned in the install guide I should look into? I'm using @0.1.0, rn@0.34.0, targetSDKVersion: 22, buildToolsVersion: 23

Thanks!

UPDATE: Here is the error in the logs. I must be missing a simple setup issue somewhere. Which is odd, because I'm using Firebase as my DB and authentication for this app, without issue.

10-04 07:44:01.716 23209-23672/com.arriver E/AzureNotificationHub: Failed to complete token refresh
java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. 
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.azure.reactnative.notificationhub.ReactNativeRegistrationIntentService.onHandleIntent(ReactNativeRegistrationIntentService.java:37)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
kcfgl commented 7 years ago

After confirming all the setup instructions on by the Firebase Messaging side and Azure Notification Hub, cleaning and re-building numerous times, I was able to clear this issue.