In App Messaging not working Due to "Service Fetch Error" - android

We just implemented in app messaging, in our existing application on Play Store. But, the in app messaging is not working, not showing any popup, So, we tried to use updated JSON, still there is no improvement and mentioned logs are showing which has errors "Service Fetch Error".
Please help.
Implementations:
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-config:21.0.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:20.1.0'
implementation 'com.google.firebase:firebase-analytics:19.0.1'
Logs:
2021-09-27 12:04:06.759 14919-14919/com.hubhopper I/FIAM.Headless: went foreground
2021-09-27 12:04:06.770 14919-14919/com.hubhopper I/FIAM.Display: Binding to activity: DashBoardActivity
2021-09-27 12:04:06.771 14919-14919/com.hubhopper I/FIAM.Headless: Setting display event component
2021-09-27 12:04:06.920 14919-14971/com.hubhopper I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: false | App Fresh Install: true
2021-09-27 12:04:06.931 14919-14971/com.hubhopper I/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/com.hubhopper/files/fiam_impressions_store_file (No such file or directory)
2021-09-27 12:04:07.211 14919-14919/com.hubhopper I/FIAM.Headless: Starting InAppMessaging runtime with Installation ID dA_tOxrhRJGCYmjyGXjM9A
2021-09-27 12:04:07.471 14919-15020/com.hubhopper W/FIAM.Headless: Service fetch error: Firebase Installations Service is unavailable. Please try again later.
2021-09-27 12:07:54.178 14919-14919/com.hubhopper I/FIAM.Display: Unbinding from activity: DashBoardActivity
2021-09-27 12:07:54.178 14919-14919/com.hubhopper I/FIAM.Headless: Removing display event component
2021-09-27 12:07:57.064 14919-14919/com.hubhopper I/FIAM.Headless: went foreground
2021-09-27 12:07:57.066 14919-14919/com.hubhopper I/FIAM.Display: Binding to activity: DashBoardActivity
2021-09-27 12:07:57.066 14919-14919/com.hubhopper I/FIAM.Headless: Setting display event component
2021-09-27 12:07:57.071 14919-14971/com.hubhopper I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: false | App Fresh Install: true
2021-09-27 12:07:57.074 14919-14971/com.hubhopper I/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/com.hubhopper/files/fiam_impressions_store_file (No such file or directory)
2021-09-27 12:07:57.252 14919-16103/com.hubhopper W/FIAM.Headless: Service fetch error: Firebase Installations Service is unavailable. Please try again later.
It's also not working using with firebase-BOM.

Here is the guidance, our api key on Google Cloud credentials is not working for firebase installations from starting.
https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md
Now, in https://console.cloud.google.com/apis/api/firebaseinstallations.googleapis.com/metrics
metrics we are getting 200 and in app messaging is also working fine.
So, if you are facing "Firebase Installations Service is unavailable" error then update the google_services.json file by making new credentials on google cloud OR restrict the firebase installations in the current key you are using for android.
Thank You.

Related

Flutter: Missing google_app_id. Firebase Analytics disabled

I want to send a notification from a device to another but when I sent it I got in the receiver device :
D/FLTFireMsgReceiver( 8876): broadcast received for message
E/FA ( 8876): Missing google_app_id. Firebase Analytics disabled. See ...
I searched in the internet but no solution works from me so I add all the verification that I found that they need to be :
In the ProjectName/android/app/Build.gradle :
In the ProjectName/android/Build.gradle :
And I added the google-services.json in the path "ProjectName/android/app/"
The problem is the API Firebase Analytics is not installed so if you need to install it and activate it :
You must follow Literally the SDK setup and configuration of google:
Then restart your Pc or Mac.

Firebase In App Messaging PERMISSION_DENIED

I did setup for firebase in App messaging. Created campaign and my app can't deliver it.
In logcat I got following logs
2019-02-26 11:22:40.616 16131-16131/app.package.name I/FIAM.Headless: Starting InAppMessaging runtime with Instance ID ciy4xtnJqBQ
2019-02-26 11:22:42.153 16131-16131/app.package.name I/FIAM.Headless: Setting display event listener
2019-02-26 11:22:42.457 16131-16131/app.package.name I/FIAM.Headless: went foreground
2019-02-26 11:22:42.464 16131-16157/app.package.name I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: false | App Fresh Install: true
2019-02-26 11:22:42.472 16131-16157/app.package.name W/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/app.package.name/files/fiam_impressions_store_file: open failed: ENOENT (No such file or directory)
2019-02-26 11:22:42.483 16131-16157/app.package.name I/FIAM.Headless: Fetching campaigns from service.
2019-02-26 11:22:42.999 16131-16157/app.package.name W/FIAM.Headless: Service fetch error: PERMISSION_DENIED: Requests to this API firebaseinappmessaging.googleapis.com method google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServing.FetchEligibleCampaigns are blocked.
Setup
Android studio 3.3.1
com.google.firebase:firebase-inappmessaging-display:17.0.5
com.google.firebase:firebase-core:16.0.7
Firebase in app messaging API enabled in Google Cloud Console
What could be reason of?
2019-02-26 11:22:42.999 16131-16157/app.package.name W/FIAM.Headless: Service fetch error: PERMISSION_DENIED: Requests to this API firebaseinappmessaging.googleapis.com method google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServing.FetchEligibleCampaigns are blocked.
The reason of the issue was restriction on API key for Android app. So InAppMessaging API was enabled for the whole project but it also require add InAppMessaging API to the specific platform API key restriction.
you have to add the firebase InApp Messaging permission to your Google Cloud API, can be done from the Google Cloud Console

Firebase Crashlytics not reporting crashes when manually enabled

Crashlytics works just fine without opt-in reporting. But it stops reporting anything as soon as I set up opt-in reporting according to the tutorial.
Specifically, I added the following content to AndroidManifest.xml
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
And I added the following into the onCreate:
Fabric.with(this, Crashlytics())
With a debugger, I am sure that the above line has been executed.
However, nothing is reported to the Crashlytics. Instead, the logger gives the following,
D/Fabric: Falling back to Crashlytics key lookup from Manifest
D/Fabric: Falling back to Crashlytics key lookup from Strings
D/Fabric: Generating Crashlytics ApiKey from google_app_id in Strings
D/Fabric: Using AdvertisingInfo from Preference Store
D/Fabric: Falling back to Crashlytics key lookup from Manifest
D/Fabric: Falling back to Crashlytics key lookup from Strings
D/Fabric: Build ID is: ...
D/CrashlyticsCore: Crashlytics is disabled, because data collection is disabled by Firebase.
D/Fabric: Initializing io.fabric.sdk.android:fabric [Version: 1.4.6.29], with the following kits:
com.crashlytics.sdk.android:crashlytics [Version: 2.9.7.29]
com.crashlytics.sdk.android:beta [Version: 1.2.10.27]
com.crashlytics.sdk.android:answers [Version: 1.4.5.29]
com.crashlytics.sdk.android.crashlytics-core [Version: 2.6.6.29]
D/Fabric: Not fetching settings, because data collection is disabled by Firebase.
D/Fabric: Falling back to Crashlytics key lookup from Manifest
D/Fabric: Falling back to Crashlytics key lookup from Strings
D/Fabric: Build ID is: ...
D/Fabric: Analytics collection disabled, because data collection is disabled by Firebase.
D/Fabric: Could not get parcel from Google Play Service to capture AdvertisingId
D/Fabric: Could not get parcel from Google Play Service to capture Advertising limitAdTracking
D/Fabric: AdvertisingInfo not present
D/Fabric: Asychronously getting Advertising Info and storing it to preferences
I have noticed this interesting line: D/CrashlyticsCore: Crashlytics is disabled, because data collection is disabled by Firebase. which is probably the cause of the issue. Yet I can't find any information about this log.
There is an issue with Firebase Crashlytics 2.9.7 preventing opt-in reporting as described in the documentation to work: the start of Crashlytics from code will not be performed.
For the time being downgrading to 2.9.6 will enable your code to work properly.
Please follow this answer
https://stackoverflow.com/a/59906454/6743289
For those wish to use crashlytics for their android app who haven't been using crashlytics of fiber.io, there are certain changes in the way you FirebaseApp is initialized which you will find in the above link.
Use following dependencies for android.
Paste it into build.gradle app:
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6#aar') {
transitive = true
}
Upgrade it from 2.9.5 to 2.9.6.
It works for me.
Add this line into Application class
Fabric.with(this, Crashlytics())
Crashlytics 2.9.8 has been released which fixes the bug. I've tested to confirm. The changelog:
2.9.8 December 21, 2018
Fixed bug with firebase_crashlytics_collection_enabled flag that erroneously disabled data collection under some circumstances.
Initialization of app is not mentioned anywhere to get crashlytics report on our console!
Step 1. First follow the official doc's link to include all dependencies as it is given there and setup your firebase app through firebase console.
Step 2. Now do the following initialization in your base application class or base activity class.
FirebaseApp.initializeApp(getApplicationContext());
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
Now clean you project and do some force crash for few times, you should be able to see your crashlytics report on your firebase console

FirebaseAuthInvalidCredentialsException ERROR_CUSTOM_TOKEN_MISMATCH

I have problems with Firebase Phone Auth.
Previously I used debug version and firebase account of user A. Then, we made publication on play market and it stopped sending sms.
I remove this project to another firebase acc that belongs to play services account owner. Created app, correctly fill in app id, connected it with play market app and then got json file from firebase and placed it in project.
When call to sendSms, nothing happpens (I did not change realization, only moved project from one acc to another)
Logs says
07-22 15:30:35.965 32553-32553/ru.falcode.lcd_android
W/DynamiteModule: Local module descriptor class for
com.google.firebase.auth not found.
07-22 15:30:35.966
32553-32553/ru.falcode.lcd_android W/BiChannelGoogleApi:
[FirebaseAuth: ] getGoogleApiForMethod() returned Gms:
com.google.firebase.auth.api.internal.zzal#3e65d46 07-22 15:30:35.977
32553-32761/ru.falcode.lcd_android W/DynamiteModule: Local module
descriptor class for com.google.firebase.auth not found. 07-22
15:30:35.984 32553-32761/ru.falcode.lcd_android I/FirebaseAuth:
[FirebaseAuth:] Loading module via FirebaseOptions.
[FirebaseAuth:] Preparing to create service connection to gms implementation 07-22 15:30:36.240 32553-32615/ru.falcode.lcd_android
V/FA: Inactivity, disconnecting from the service 07-22 15:30:36.608
32553-32553/ru.falcode.lcd_android W/TAG: onVerificationFailed
com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The custom token corresponds to a different audience. [ App ID does
not match requested project. ]
at com.google.firebase.auth.api.internal.zzce.zzb(Unknown Source)
at com.google.firebase.auth.api.internal.zzdf.zza(Unknown Source)
at com.google.firebase.auth.api.internal.zzdg.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6195)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) 07-22
15:30:36.608 32553-32553/ru.falcode.lcd_android
E/FirebaseAuthInvalidCredentialsException: The custom token
corresponds to a different audience. [ App ID does not match requested
project. ]
ERROR_CUSTOM_TOKEN_MISMATCH
We never used custom keys. Just an example from git hub with no customization over it.
How to fix it?
I agree the error code is confusing. But the error message is key here: "App ID does not match requested project. " The same app used to obtain the phone auth credential should be the one used to sign in with it. That is why you are getting the error. It seems like you are getting the phone auth credential with one application and then signing in with that credential using another app.
I think you are testing your project with a normal .apk in your mobile or in the emulator. If you want to test your project for mobile authentication you have to provide your mobile number in the firebase mobile authentication in sing-in-method. Testing the mobile number(Optional mobile number) by which you want to test. Or you make a signed .apk and then try it again I think it will work fine.

Firebase Analytics events don't show up (Android)

I have an issue with Firebase Analytics. It basically boils down to the fact that nothing is registered; I have no data in my analytics page in the console.
I noticed today that when I want to send a push notification and I set a filter for the version number of my app, it shows "No versions available for this app". However, my iOS version of the app IS showing a version number in the dropdown list.
Does anyone have an idea what the issue is?
Some other issues I'm still experiencing:
"Firebase API initialization failure." IncompatibleClassChangeError ContextCompat.getNoBackupFilesDir() -> InvocationTargetException
Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"
Many thanks in advance.
the failed to load is not the problem, i have it too when using firebase-invites and i found this (Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor")
the "Firebase API initialization failure." IncompatibleClassChangeError ContextCompat.getNoBackupFilesDir() -> InvocationTargetException
was fixed by updating the google services in the device

Categories

Resources