RequestActivityTransitionUpdates提供空结果

时间:2018-11-23 12:35:16

标签: android activitytransitionapi

我正在使用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");

                }
            }
    );
}

0 个答案:

没有答案