Nilesh Rathore
Nilesh Rathore

Reputation: 900

Firebase In-App Messaging - PERMISSION_DENIED (Requests blocked issue) in Android

Recently I setup Firebase In-App Messaging in my existing project, but when I'm running the application for testing I'm getting PERMISSION_DENIED issue. The project already using many other services of firebase like FCM, Dynamic Links, Crashlytics, etc and all are working fine. Please help it out.

Configurations I have done

Dependencies in app gradle

implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.2'

The firebase logs are

    I/FIAM.Headless: Starting InAppMessaging runtime with Instance ID cNqdR69UnlM
    I/FIAM.Headless: Setting display event listener
    I/FIAM.Headless: went foreground
    I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: false | App Fresh Install: true
    I/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/com.social.dapp.debug/files/fiam_impressions_store_file (No such file or directory)
    I/FIAM.Headless: Fetching campaigns from service.
    I/FIAM.Headless: Removing display event listener
    W/FIAM.Headless: Service fetch error: PERMISSION_DENIED: Requests from this Android client application com.social.dapp.debug are blocked.
    I/FIAM.Headless: Setting display event listener
    I/FIAM.Headless: Removing display event listener

Upvotes: 1

Views: 9306

Answers (5)

m_b
m_b

Reputation: 31

I had the same issue with "PERMISSION_DENIED" error message. I resolved it by modifying "API restrictions" in the Google Cloud console:

Google Cloud Console -> APIs & Services -> Credentials -> API Keys -> Edit API Key -> Enable "Firebase In-App Messaging API" under API restrictions. Google Cloud Console

Upvotes: 1

Vinay Revankar
Vinay Revankar

Reputation: 832

I noticed that this issue occurs if you integrate In-App messaging and update the existing build in the device. If you uninstall and freshly install the build it will start working

Upvotes: 0

Nilesh Rathore
Nilesh Rathore

Reputation: 900

It started to work in my release build. Yesterday I build the signed app and uploaded it to the play store and in that app In-App Messaging working utterly fine, I still don't know why it is not working in debug app while I have configured right SHA1 for debugging app also and all other services of firebase also working fine in debug.

Upvotes: 1

Enrique Del Valle
Enrique Del Valle

Reputation: 520

I have seen on github firebase/firebase-android-sdk repository(https://github.com/firebase/firebase-android-sdk/issues/133) a issue like yours and they resolve it Re-imported google-services.json from console.

Upvotes: 0

You have to add rules for your app in Firebase, go to:

Firebase console -> select your project -> Database -> Rules -> and add: allow read allow write

For security reasons I recomend you read this article first

https://firebase.google.com/docs/rules

Upvotes: 0

Related Questions