Firebase audiences and cloud messaging not working

Viewed 86

Background

I have apps I have 2 apps (Production and Staging) with the same application id com.myapp. They are set up as 2 separate Firebase projects I'm switching between at runtime (admin users can switch environment in-app)

FirebaseOptions.Builder builder = new FirebaseOptions.Builder()
            .setProjectId(isProd ?
                    getString(R.string.project_id)
                    : getString(R.string.google_project_id_staging))
            .setApplicationId(isProd ?
                    getString(R.string.google_app_id)
                    : getString(R.string.google_app_id_staging))
            .setApiKey(isProd ?
                    getString(R.string.google_api_key)
                    : getString(R.string.google_api_key_staging));

    firebaseApp = FirebaseApp.initializeApp(this, builder.build());

Problems

  1. Firebase audiences showing 0 user when I filter by user id, in both Production and Staging apps enter image description here of course, I have firebaseAnalytics.setUserId(userId) in my client code

  2. When I send a push notification with Cloud Messaging (FCM) it never arrived

Push notifications sent to all users have been working fine of course

  1. Maybe relevant maybe not: When I run the Staging app and enabled debug mode, the events are reported to Debug View of the Production Firebase project, while the Debug View of the Staging project remained empty enter image description here

Could this be because my 2 apps have the same application id?

Is there anything I can do to make it work?

0 Answers
Related