1

Version of Mobile SDK Used: SalesforceMobileSDK-Android v 8.1

Issue found in : React Native

OS Version: Mac OX - Catalina 10.15

Device: Nokia 8.1 Android version 10

Steps to reproduce: Login in application. After login, the firebase init fails and the user it s not register in Salesforce for push notification. Connection between salesforce and firebase fails, direct connection between application and firebase it s working.

Actual behavior: User can t be seen as register for push notification.

Expected Behavior: User should be seen as register for push notifications, user should receive push notification from salesforce

Error Log:

We get this error:

java.lang.IllegalStateException: FirebaseApp with name'Project Name xxxx ' doesn't exist. Available app names: [DEFAULT] at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:218) at com.salesforce.androidsdk.push.PushMessaging.initializeFirebaseIfNeeded(PushMessaging.java:170) at com.salesforce.androidsdk.push.PushMessaging.register(PushMessaging.java:102) at com.salesforce.androidsdk.ui.OAuthWebviewHelper.addAccount(OAuthWebviewHelper.java:673) at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:583) at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:513) at android.os.AsyncTask.finish(AsyncTask.java:755) at android.os.AsyncTask.access$900(AsyncTask.java:192) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 2020-08-09 18:37:28.462 25452-25768/xxxxxxxxxxxxxxxx E/RegIntentService: Error during FCM registration java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google. at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(Unknown Source:8) at com.google.firebase.iid.FirebaseInstanceId.checkRequiredFirebaseOptions(com.google.firebase:firebase-iid@@20.2.3:52) at com.google.firebase.iid.FirebaseInstanceId.getInstance(com.google.firebase:firebase-iid@@20.2.3:2) at com.salesforce.androidsdk.push.SFDCRegistrationIntentService.onHandleWork(SFDCRegistrationIntentService.java:62) at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392) at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383) at android.os.AsyncTask$3.call(AsyncTask.java:378) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)3. OS Version: the connection between application and firebase it s working and we get push notifications in app, the google-services.json it's valid and the project_id it s valid.

We found that in

package com.salesforce.androidsdk.push;

if we change in method

public static void initializeFirebaseIfNeeded(Context context)

the FirebaseOptions builder from :

final FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
         .setGcmSenderId(pushClientId)
         .setApplicationId(context.getPackageName()).build();

to

       final FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
         .setGcmSenderId(pushClientId)
       .setProjectId("xxxxxx")
       .setApiKey("xxxxxxxxxx")
      .setApplicationId("xxxxxxxx").build();

The initialization of Firebase takes place and the user it s registered to salesforce and we get push notification.

The solution was used only to see if the connection between salesforce sdk and firebase takes place and it worked, on our mobile application we are using @react-native-firebase/app:8.2.0 and @react-native-firebase/messaging:7.6.0

Thank you

2
  • 1
    I've reached out to the team internally, but I would still strongly suggest that you open a support case through your account representative. – Bill Mote Aug 14 '20 at 13:58
  • There is a work item to make this plugin work with the changed Firebase Messaging API. Keep an eye out for the fix in an upcoming release. – Bill Mote Aug 19 '20 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.