Code example for ActivityRecognitionClient

Methods: disconnectisConnectedremoveActivityUpdates

0
    @Override 
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            mClient.connect();
        } else { 
            if (mClient == null || !mClient.isConnected()) {
                return; 
            } 
 
            mClient.removeActivityUpdates(mPendingIntent);
            mClient.disconnect();
        } 
 
        PreferenceManager.getDefaultSharedPreferences(this).edit()
                .putBoolean("service", isChecked).commit();
    } 
 
    @Override 
    protected void onDestroy() { 
        super.onDestroy(); 
Connect your IDE to all the code out there  Get Codota for Java