Code example for ActivityRecognitionClient

Methods: disconnectremoveActivityUpdates

0
	 
	@Override 
	protected void onDestroy() { 
		super.onDestroy(); 
		if(arclient!=null){
			arclient.removeActivityUpdates(pIntent);
			arclient.disconnect();
		} 
		unregisterReceiver(receiver);
	} 
	 
	@Override 
	public void onConnectionFailed(ConnectionResult arg0) {
		Toast.makeText(this, "Connection Failed", Toast.LENGTH_SHORT).show();
	} 
	@Override 
	public void onConnected(Bundle arg0) {
		Intent intent = new Intent(this, ActivityRecognitionService.class);
		pIntent = PendingIntent.getService(this, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);
		arclient.requestActivityUpdates(1000, pIntent);