public class

PromptPermissionAction

extends Action
java.lang.Object
   ↳ com.urbanairship.actions.Action
     ↳ com.urbanairship.actions.PromptPermissionAction
Known Direct Subclasses

Class Overview

An action that prompts for permission.

Expected value: - permission: post_notifications, contacts, bluetooth, location, media, mic, or camera - fallback_system_settings: true to navigate to app settings if the permission is silently denied. - allow_airship_usage: If the permission is granted, any Airship features that depend on the permission will be enabled as well, e.g., enable user notifications on PushManager and push feature on privacy Manager if notifications are allowed.

Accepted situations: SITUATION_PUSH_OPENED, SITUATION_WEB_VIEW_INVOCATION, SITUATION_MANUAL_INVOCATION, SITUATION_AUTOMATION, and SITUATION_FOREGROUND_NOTIFICATION_ACTION_BUTTON.

Default Result: empty. The actual permission result can be received using a ResultReceiver in the metadata.

Default Registration Names: DEFAULT_REGISTRY_NAME, DEFAULT_REGISTRY_SHORT_NAME

Summary

Nested Classes
class PromptPermissionAction.Args  
Constants
String AFTER_PERMISSION_STATUS_RESULT_KEY Resulting permission status key when using a result receiver.
String BEFORE_PERMISSION_STATUS_RESULT_KEY The starting permission status key when using a result receiver.
String DEFAULT_REGISTRY_NAME Default registry name
String DEFAULT_REGISTRY_SHORT_NAME Default registry short name
String ENABLE_AIRSHIP_USAGE_ARG_KEY Enable airship usage argument key.
String FALLBACK_SYSTEM_SETTINGS_ARG_KEY Fallback system settings argument key.
String PERMISSION_ARG_KEY Permission argument key.
String PERMISSION_RESULT_KEY Permissions result key when using a result receiver.
String RECEIVER_METADATA Metadata key for a result receiver.
[Expand]
Inherited Constants
From class com.urbanairship.actions.Action
Public Constructors
PromptPermissionAction(Supplier<PermissionsManager> permissionsManagerSupplier)
PromptPermissionAction()
Public Methods
boolean acceptsArguments(ActionArguments arguments)
Called before an action is performed to determine if the the action can accept the arguments.
final ActionResult perform(ActionArguments arguments)
Performs the action.
void sendResult(Permission permission, PermissionStatus before, PermissionStatus after, ResultReceiver resultReceiver)
boolean shouldRunOnMainThread()
Determines which thread runs the action.
Protected Methods
PromptPermissionAction.Args parseArg(ActionArguments arguments)
void prompt(PromptPermissionAction.Args args, ResultReceiver resultReceiver)
[Expand]
Inherited Methods
From class com.urbanairship.actions.Action
From class java.lang.Object

Constants

public static final String AFTER_PERMISSION_STATUS_RESULT_KEY

Resulting permission status key when using a result receiver.

Constant Value: "after"

public static final String BEFORE_PERMISSION_STATUS_RESULT_KEY

The starting permission status key when using a result receiver.

Constant Value: "before"

public static final String DEFAULT_REGISTRY_NAME

Default registry name

Constant Value: "prompt_permission_action"

public static final String DEFAULT_REGISTRY_SHORT_NAME

Default registry short name

Constant Value: "^pp"

public static final String ENABLE_AIRSHIP_USAGE_ARG_KEY

Enable airship usage argument key.

Constant Value: "enable_airship_usage"

public static final String FALLBACK_SYSTEM_SETTINGS_ARG_KEY

Fallback system settings argument key.

Constant Value: "fallback_system_settings"

public static final String PERMISSION_ARG_KEY

Permission argument key.

Constant Value: "permission"

public static final String PERMISSION_RESULT_KEY

Permissions result key when using a result receiver.

Constant Value: "permission"

public static final String RECEIVER_METADATA

Metadata key for a result receiver. Use PermissionResultReceiver to simplify parsing the result.

Constant Value: "com.urbanairship.actions.PromptPermissionActionReceiver"

Public Constructors

public PromptPermissionAction (Supplier<PermissionsManager> permissionsManagerSupplier)

public PromptPermissionAction ()

Public Methods

public boolean acceptsArguments (ActionArguments arguments)

Called before an action is performed to determine if the the action can accept the arguments.

Parameters
arguments The action arguments.
Returns
  • true if the action can perform with the arguments, otherwise false.

public final ActionResult perform (ActionArguments arguments)

Performs the action.

Parameters
arguments The action arguments.
Returns
  • The result of the action.

public void sendResult (Permission permission, PermissionStatus before, PermissionStatus after, ResultReceiver resultReceiver)

public boolean shouldRunOnMainThread ()

Determines which thread runs the action.

Returns
  • true if the action should be run on the main thread, or false if the action should run on a background thread.

Protected Methods

protected void prompt (PromptPermissionAction.Args args, ResultReceiver resultReceiver)