java - How to check enable or disable status from Google Fit -
when user disable google fit, want app check status whether google fit enabled or disabled. have found code disable app.
public void disablegooglefit(){ if(!mclient.isconnected()){ log.e(tag, "google fit wasn't connected"); return; } pendingresult<status> pendingresult = fitness.configapi.disablefit(mclient); pendingresult.setresultcallback(new resultcallback<status>() { @override public void onresult(status status) { if(status.issuccess()) { log.i(tag, "google fit disabled"); }else{ log.e(tag, "google fit wasn't disabled " + status); } } }); }
how detect when intent invoked?
you can check google's getting started documentation, here code sample in document:
if (mclient == null && checkpermissions()) { mclient = new googleapiclient.builder(this) .addapi(fitness.sensors_api) .addscope(new scope(scopes.fitness_location_read)) .addconnectioncallbacks( new googleapiclient.connectioncallbacks() { @override public void onconnected(bundle bundle) { log.i(tag, "connected!!!"); // can make calls fitness apis. findfitnessdatasources(); }
this check connection google fit.
hope helps!
Comments
Post a Comment