Package 

Class NotificationPermissionHelper

    • Method Summary

      Modifier and Type Method Description
      boolean isNotificationPermissionGranted(Context context)
      void requestPermission(@NonNull() Context context, boolean handleTargetLowerThan13, @Nullable() BroadcastReceiver receiver) Request the Android 13 notification runtime permissionTODO: Test this method.
      boolean isPermissionAlreadyAskedFromOlderSDK(@NonNull() Context context)
      void requestPermissionFromOlderSDK(@NonNull() Context context) Request the permission the google way: by creating the notification channel.If the App is running in background at this moment (eg: receiving a push for the first time),the user will be prompted when app goes back in foreground.Note: if the user has a channel id override, this will not work.
      void onReceive(Context context, Intent intent) Broadcast receiver to handle the permission result
      • Methods inherited from class android.content.BroadcastReceiver

        abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, getSentFromPackage, getSentFromUid, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, onReceive, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • requestPermission

         void requestPermission(@NonNull() Context context, boolean handleTargetLowerThan13, @Nullable() BroadcastReceiver receiver)

        Request the Android 13 notification runtime permissionTODO: Test this method. Can't be done until Android T is supported in Robolectric

        Parameters:
        context - context
        handleTargetLowerThan13 - whether we should trigger the permission request for an app targeting lower than Android 13.
      • requestPermissionFromOlderSDK

         void requestPermissionFromOlderSDK(@NonNull() Context context)

        Request the permission the google way: by creating the notification channel.If the App is running in background at this moment (eg: receiving a push for the first time),the user will be prompted when app goes back in foreground.Note: if the user has a channel id override, this will not work.

        Parameters:
        context - context
      • onReceive

         void onReceive(Context context, Intent intent)

        Broadcast receiver to handle the permission result

        Parameters:
        context - Context
        intent - Broadcasted intent from BatchPermissionActivity