GetTokenAsync

open class GetTokenAsync

AsyncTask for retrieving Huawei Mobile Services push token asynchronously.

Use this class when you need to manually retrieve the HMS push token for advanced scenarios such as manual registration or sending the token to your backend server. Example:


new PushwooshHmsHelper.GetTokenAsync(new PushwooshHmsHelper.OnGetTokenAsync() {

    
    public void onGetToken(String token) {
        // Token retrieved successfully
        PushwooshHmsHelper.onTokenRefresh(token);
    }

    
    public void onError(String error) {
        // Token retrieval failed
        Log.e("HMS", "Failed: " + error);
    }
}).execute();

See also

Constructors

Link copied to clipboard
constructor(onGetTokenAsync: PushwooshHmsHelper.OnGetTokenAsync)