ably-java icon indicating copy to clipboard operation
ably-java copied to clipboard

Expose push intent action strings (e.g. `"io.ably.broadcast.PUSH_ACTIVATE"`)

Open ben-xD opened this issue 4 years ago • 0 comments

Some of these strings were previously not documented at all. Now that they are (see https://github.com/ably/docs/pull/1177), we should prevent users having to manually use these strings in their app.

These strings should be public string in ably-java, so users can import them.

static final String PUSH_ACTIVATE_ACTION = "io.ably.broadcast.PUSH_ACTIVATE"; static final String PUSH_DEACTIVATE_ACTION = "io.ably.broadcast.PUSH_DEACTIVATE"; static final String PUSH_UPDATE_FAILED_ACTION = "io.ably.broadcast.PUSH_UPDATE_FAILED";

These strings are required for the user to listen to intents with these action strings: to be notified of activation events:

    private void register(Context context) {
      IntentFilter filter = new IntentFilter();
      filter.addAction(PUSH_ACTIVATE_ACTION);
      filter.addAction(PUSH_DEACTIVATE_ACTION);
      filter.addAction(PUSH_UPDATE_FAILED_ACTION);
      LocalBroadcastManager.getInstance(context).registerReceiver(this, filter);
    }

They are currently magic strings in the SDK. e.g.:

AsyncWaiter<Intent> activateWaiter = broadcastWaiter("PUSH_ACTIVATE");

and sendErrorIntent("PUSH_DEACTIVATE", reason);

┆Issue is synchronized with this Jira Story by Unito

ben-xD avatar Sep 21 '21 11:09 ben-xD