Code example for ActivityRecognitionClient

Methods: requestActivityUpdates

0
    @Override 
    public void onConnected(Bundle bundle) {
        Intent intent = new Intent(this, ActivityRecIntentService.class);
        PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        activityRecognitionClient.requestActivityUpdates(FIVE_MINUTES, pendingIntent);
    } 
 
    @Override 
    public void onDisconnected() { 
    } 
 
    @Override 
    public void onConnectionFailed(ConnectionResult connectionResult) {
    } 
 
    @Override 
    protected void onDestroy() { 
        super.onDestroy(); 
        activityRecognitionClient.disconnect();