我正在使用ActivityRecognitionClient通过遵循this
来进行活动转换但是在成功中,结果始终为空。
public void requestActivityTransitionUpdate(final Context context){
ActivityTransitionRequest activityTransitionRequest = buildActivityTransitionRequest();
Intent tempIntent = new Intent(this, ReceiverActivityTransition.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, tempIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Task task = ActivityRecognition.getClient(context).requestActivityTransitionUpdates(activityTransitionRequest, pendingIntent);
task.addOnSuccessListener(
new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void result) {
Log.i("Success","LocationUpdatesService");
}
}
);
task.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(Exception e) {
// Handle error
Log.i("Success","LocationUpdatesService");
}
}
);
}