SoFunction
Updated on 2025-04-10

Android Aurora push alias and tags

Android Aurora Push Alias, Tags, RegistrationID

illustrate

Alias

For users who have installed the application, use an alias to identify them. When you give the user a message in the future, this alias can be specified. Each user can only specify one alias.

Suggestion: For the same application, it is recommended that different users set different aliases to ensure the uniqueness of user aliases. (Aurora does not restrict the same alias from correspondence to only one user. When an alias specifies multiple users, when pushing messages to this alias, multiple users corresponding to this alias will receive the push messages)

Tags (tags)

Tag users, mainly used to push messages to specific batch users. Multiple tags can be set for one user.

registrationId (device unique identifier)

When the application successfully registers to the Aurora server for the first time, the Aurora server returns a unique identifier for the device - RegistrationID to the client. The JPush SDK sends the RegistrationID in broadcast form to the application.

The application can save this RegistrationID on its own application server, and then push messages or notifications to the device according to the RegistrationID.

setMobileNumber

Version 3.1.1 begins to provide an interface for setting mobile phone numbers for SMS supplement function.

Supported operations

Alias ​​and tags support the operations of adding, deleting, modifying and checking.

registrationId only supports query operations.

Operation of alias:

Method - setAlias

Call this API to set the alias.

This interface is overlay logic, not incremental logic. That is, the new call will overwrite the previous settings.

public static void setAlias(Context context, int sequence, String alias);

Parameter definition

sequence

The user-defined operation sequence number is returned together with the operation result and is used to identify the uniqueness of an operation.

alias

Valid alias composition: letters (case sensitive), numbers, underscores, Chinese characters, special characters @!#$&*+=.|.

Limit: The alias name length is limited to 40 bytes. (UTF-8 encoding is required to determine the length)

Method - deleteAlias

Call this API to delete the alias.

public static void deleteAlias(Context context,int sequence);

Method - getAlias

Call this API to query the alias.

public static void getAlias(Context context,int sequence);

Tag operation:

Method - setTags

Call this API to set the tag.

It should be understood that this interface is overlay logic, not incremental logic. That is, the new call will overwrite the previous settings.

public static void setTags(Context context, int sequence,Set tags);

Parameter definition

sequence

The user-defined operation sequence number is returned together with the operation result and is used to identify the uniqueness of an operation.

tags

Valid tag composition: letters (case sensitive), numbers, underscores, Chinese characters, special characters @!#$&*+=.|.

Limitation: The naming length of each tag is limited to 40 bytes, and the maximum number of tags is supported to set up to 1,000 tags, and the total length of a single operation must not exceed 5,000 bytes. (UTF-8 encoding is required to determine the length)

A maximum of 1000 tags are supported for a single device. There is no limit on the number of global tags for the App.

Method - addTags

Call this API to add new tags.

public static void addTags(Context context, int sequence,Set tags);

Method - deleteTags

Call this API to delete the specified tag.

public static void deleteTags(Context context, int sequence,Set tags);

Method - cleanTags

Call this API to clear all tags.

public static void cleanTags(Context context, int sequence);

Method - getAllTags

Call this API to query all tags.

public static void getAllTags(Context context, int sequence);

Method - checkTagBindState

Call this API to query the status of the specified tag bound to the current user.

public static void checkTagBindState(Context context,int sequence,String tag);

Operation of registrationId

After the SDK is successfully registered for the first time, the developer will obtain the corresponding RegistrationID by listening to Action - in the custom Receiver.

After the registration is successful, you can also get it through the function public static String getRegistrationID(Context context)

Give an example:

When the app is registered successfully for the first time, or after the registration is successful, the getRegistrationId interface gets the registrationId. When the app is logged in internally, the server saves the current registrationId, and the server pushes the message based on the saved registrationId

Message callback method description

Class -

The related callback class in the new message callback mode.

1. New tag and alias operation callbacks will be triggered in the subclass of the class defined by the developer.

2. The callback set by the mobile phone number will be triggered in the subclass of the class defined by the developer.

This class is the parent class of the callback. The developer needs to inherit the class and configure the corresponding class in Manifest. The result of the interface operation will be called back in the following methods in the class you configured.

Method - onAliasOperatorResult

The alias-related operations will callback the result in this method.

Method - onTagOperatorResult

Tag The operation of adding, deleting, searching and modifying will callback the result in this method.

Method - onCheckTagOperatorResult

The operation to query the binding status of a tag and the current user will callback the result in this method.

Method - onMobileNumberOperatorResult

Setting the mobile phone number will callback the result in this method.

/**
  * Custom JPush message receiver, including the return of the result of operating tag/alias (only including the new interface part of tag/alias)
  * */
public class MyJPushMessageReceiver extends JPushMessageReceiver {

 @Override
 public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
  ().onTagOperatorResult(context,jPushMessage);
  (context, jPushMessage);
 }
 @Override
 public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage){
  ().onCheckTagOperatorResult(context,jPushMessage);
  (context, jPushMessage);
 }
 @Override
 public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
  ().onAliasOperatorResult(context,jPushMessage);
  (context, jPushMessage);
 }

 @Override
 public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
  ().onMobileNumberOperatorResult(context,jPushMessage);
  (context, jPushMessage);
 }
}

The above article on Android Aurora push alias and tags is all the content I share with you. I hope you can give you a reference and I hope you support me more.