2
votes
com.huawei.hms.kit.awareness.b.HHJ:HMSBase Exception Code 907135701

I am getting this error above while trying to fetch information from Awareness kit. How can I solve this problem? I have already enabled the awareness service from the developer console.

The code I have written so far :

double latitude = 45.4943;
double longitude = 107.7436;
double radius = 200;
AwarenessBarrier enterBarrier = LocationBarrier.enter(latitude, longitude, radius);

final String BARRIER_RECEIVER_ACTION = getApplication().getPackageName() + "LOCATION_BARRIER_RECEIVER_ACTION";
Intent intent = new Intent(BARRIER_RECEIVER_ACTION); 
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
LocationBarrierReceiver barrierReceiver = new LocationBarrierReceiver();
registerReceiver(barrierReceiver, new IntentFilter(BARRIER_RECEIVER_ACTION));


String locationBarrierLabel = "location enter barrier";
BarrierUpdateRequest.Builder builder = new BarrierUpdateRequest.Builder();
BarrierUpdateRequest request = builder.addBarrier(locationBarrierLabel, enterBarrier,pendingIntent).build();
Awareness.getBarrierClient(context).updateBarriers(request)
        .addOnSuccessListener(new OnSuccessListener<Void>() {
            @Override
            public void onSuccess(Void aVoid) {
                Toast.makeText(getApplicationContext(), "add barrier success", Toast.LENGTH_SHORT).show();
            }
        })
        .addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(Exception e) {
                Toast.makeText(getApplicationContext(), "add barrier failed", Toast.LENGTH_SHORT).show();
                Log.e(TAG, "add barrier failed", e);
            }
        });

And my Receiver :

class LocationBarrierReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        BarrierStatus barrierStatus = BarrierStatus.extract(intent);
        String label = barrierStatus.getBarrierLabel();
        switch(barrierStatus.getPresentStatus()) {
            case BarrierStatus.TRUE:
                Log.i(TAG, label + " status:true");
                break;
            case BarrierStatus.FALSE:
                Log.i(TAG, label + " status:false");
                break;
            case BarrierStatus.UNKNOWN:
                Log.i(TAG, label + " status:unknown");
                break;
        }
    }
}

And my dependencies are

implementation 'com.huawei.hms:awareness:1.0.6.300'

implementation 'com.huawei.hms:nearby:5.0.1.300'
3
look up what the error code meansZun

3 Answers

0
votes

Either your phone does not have HMS Core installed in it, or you have an outdated version. Please Install/Update it.

0
votes

In gradle you have to use the given version. The version which you mention is not correct.

implementation 'com.huawei.hms:awareness:1.0.4.301'

According to the official document this is the latest version released on 2020-04-30. For more details about the version kindly visit the given link: https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/awareness-version-change-history#h1-1588140839497-0

Hope your problem will solve.

0
votes

In addition to making sure you have the latest version of HMS Core installed and calling the latest version of the HMS Awareness Kit, try the troubleshoot steps in the official documentation for your error code (907135701, ErrorCode.SCOPE_LIST_EMPTY).

"Check whether the current app has been created and has applied for related services." https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/error-code-0000001050045846-V5

The error code reference above suggests that the app might not have been created on your AppGallery console yet. Here is the relevant guide for that. https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-agc-0000001050033101