Answered

Intercom SDK for Android, API 33 and NOTIFICATION permission

  • 22 August 2023
  • 3 replies
  • 271 views

For an Android app that targets API 33 and that includes FCM for push notifications, what is the advice on requesting the NOTIFICATION permission?

My usecase: We have a tab in our app that when pressed, calls Intercom.client().present(). While the user is viewing the HelpCenter, the user could start a customer support chat. This is an ideal moment to request the NOTIFICATION permission. The user just sent a chat message and likely expects a notification when there is a reply.

Is there a way for our app to know when the user sent a message so we can request the permission? Or does the intercom SDK request the notification permission on behalf of the app if needed?

Versions:

  • Intercom Android SDK v15.1.3
  • App targetSDK 33
  • Firebase BOM 30.0.0 (Firebase Messaging 23.0.4)
icon

Best answer by Racheal 1 September 2023, 02:50

View original

3 replies

Does anyone have any idea about this? Intercom SDK does not seem to request the POST_NOTIFICATIONS permission. We would like to request it but only when it is really needed. How are other folks dealing with this?

Userlevel 4
Badge +5

Hey @Kiran Rao Racheal from the support engineer team here👋 

 

Have you had a chance to look through our Android SDK Push Notifications Dev Doc? The details provided in the SDK ReadMe on Github are quite useful as well - it mentions (here) that "Apps targeting Android 13 should request a runtime permission to enable notifications. Add the following code to request permission."

registerForActivityResult(
ActivityResultContracts.RequestPermission()
) {
if (isGranted) {
// Permission is granted. Continue the action or workflow in your
// app.
} else {
// Explain to the user that the feature is unavailable because the
// features requires a permission that the user has denied. At the
// same time, respect the user's decision. Don't link to system
// settings in an effort to convince the user to change their
// decision. }
}

Let me know if this helps!

@Racheal Ah I missed that in the README. I was following this guide which does not mention the POST_NOTIFICATIONS permission. That answers the first part of my question.

How about the app being notified by the Intercom SDK when the user sends a chat message? Our usecase for the POST_NOTIFICATIONS pemission is to notify the user when there is a reply to their chat message. We would like to delay asking for this permission until the user actually sends a chat. In other words, we want to avoid asking for this permission the first time the user launches the Help Center.

Is there a way to achieve this?

Reply