Leanplum / Leanplum-Android-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
46 stars 40 forks source link

Enable user for onRequestPermissionResult feedback #544

Closed hborisoff closed 1 year ago

hborisoff commented 1 year ago
What Where/Who
JIRA Issue SDK-2828
People Involved @hborisoff

Background

A client reported that his activity onPause and onResume are getting executed when the Push Pre-Permission inapp is triggered even if the permission has been declined twice in a row. The cause of the issue is the code that is requesting the permission, because the Leanplum SDK doesn't know whether the permission has been declined, neither the Android SDK provides such method. The only possible solution is to ask the user for input on his onRequestPermissionResult.

If user dismisses the native dialog without clicking Allow or Don't Allow button the system will return PERMISSION_DENIED in the onRequestPermissionResult.

User can call PushPermissionUtilKt.onRequestPermissionResult from his implementation of onRequestPermissionResult to give feedback in the SDK. He can also reset the declineCounter or directly set it as 2 to disable the permission request.