androidpush-notificationhuawei-mobile-servicespushkithuawei-push-notification

Huawei Push Kit getToken throws ApiException 6005: permission not authorized


I'm developing an application using Huawei push service and it was working fine until the last couple of days the

String appId = AGConnectServicesConfig.fromContext(this).getString("client/app_id");
String hmsToken = HmsInstanceId.getInstance(this).getToken(appId, DEFAULT_TOKEN_SCOPE);

started throwing not authorized exception i triple checked my setting in app gallery connect and all seem fine

enter image description here


Solution

  • Someone gave me this answer on the Huawei developer forums and it worked. Just add the HMS toolkit plugin to Android studio and run the configuration wizard. It checks all your added Huawei services, along with agcconnect.json file, and it rebuilds your project.