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'