config-plugin-react-native-intercom icon indicating copy to clipboard operation
config-plugin-react-native-intercom copied to clipboard

Push notification permission is always granted on Android

Open eexit opened this issue 2 years ago • 5 comments

Hello,

Firstly, thank you for your plugin. Very useful.

However, I would like to report something broken. I'm not React Native expert but according to Intercom documentation, some carousels can trigger for device permission. Which is great and offload all the permission request logic to the Intercom code.

For the push notification permission, I noticed that the carousel is always considering that the permission is granted on Android.

Steps to reproduce:

  1. Create an Intercom carousel with "Push notification" for the Button Action
  2. Set it live and copy its ID
  3. In the App, do an Intercom login and trigger a await Intercom.presentContent(IntercomContent.carouselWithCarouselId(copiedCarouselId));
  4. The carousel launches as expected
  5. The "Button Action" is filled with a tick icon instead of displaying 2 buttons (meaning the permission is already granted)

Doc: https://www.intercom.com/help/en/articles/4164612-design-and-build-a-mobile-carousel#things-to-note-about-requesting-device-permissions

Tested with:

  • @intercom/intercom-react-native@^4.0.1
  • config-plugin-react-native-intercom@main
  • expo@~48.0.6
  • Android 9 & 13

After some digging, the issue seems to be related to the MainNotificationService being injected to the Android source code. I believe this service is required to receive notifications but I suspect the call to IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken) to register the device Intercom and flag the device has "granted for push notifications" while it's not the case.

Is there any chance we could sort this out so we could leverale this Intercom feature?

Thanks!

eexit avatar Mar 20 '23 09:03 eexit

Hello, any idea for this issue?

Thanks!

eexit avatar Mar 27 '23 10:03 eexit

@eexit are you seeing the same behaviour for Android 9 and Android 13? If I remember correctly on Android 9 push notification permission is granted on app installation. While on Android 13 it is similar to iOS permissions model when it should be requested.

enagorny avatar Mar 27 '23 11:03 enagorny

Correct, android permissions changed in Android 13

elmaxe avatar Mar 27 '23 12:03 elmaxe

Hello,

This is not about the device permission, this is about Intercom knowing about that permission. For Android 13, the device permission is not granted by default but yet the Intercom Carousel, somehow, thinks it is.

On Android < 13, if you deny explicitly the permission, then launch the carousel, it will still show the permission as granted while it should not.

This behavior works as expected on iOS.

I'm not sure if this is the way this plugin is implemented or if this is the way Intercom interpret the “permission granting”.

Thanks for your input!

eexit avatar Mar 27 '23 13:03 eexit

Hello,

Has anyone confirmed this behavior?

Thanks!

eexit avatar Apr 06 '23 13:04 eexit