-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":40,"versionName":"202110281025","enabled":true,"outputFile":"ICL02Sport_V40_202110281025_release.apk","fullName":"release","baseName":"release"},"path":"ICL02Sport_V40_202110281025_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":41,"versionName":"202112101533","enabled":true,"outputFile":"ICL02Sport_V41_202112101533_release.apk","fullName":"release","baseName":"release"},"path":"ICL02Sport_V41_202112101533_release.apk","properties":{}}]
\ No newline at end of file
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.ic.aidl.ped.IPedAidlInterface;
import com.ic.aidl.ped.IPedRemoteService;
import com.ic.aidl.ped.RecordParcelable;
+import com.ic.iclooger.ICLogger;
import com.ic.sport.util.IcLog;
-import com.ic.sport.util.ServiceUtil;
import java.util.Collections;
import java.util.List;
private MutableLiveData<List<RecordParcelable>> mObsPedRecord;
private MutableLiveData<Float> mCalorie;
private final ExecutorService executorService;
+ private boolean isBind;
public PedometerPresenter(Context context) {
mContext = context;
public void run() {
synchronized (mLock) {
if (mService != null) {
+ ICLogger.d("do queryPedCount task...");
try {
mService.queryPedCount();
} catch (Exception e) {
};
public void bindService() {
- ServiceUtil.bindServiceUtil(mContext, "com.ic.action.WORK_SERVICE",
- connection, mContext.getPackageName(), 103);
+ Intent intent = new Intent();
+ intent.setAction("com.ic.action.WORK_SERVICE");
+ intent.setPackage("com.ic.work");
+ intent.putExtra("target", "sport");
+ isBind = mContext.bindService(intent, connection, Context.BIND_AUTO_CREATE);
}
public void unbindService() {
try {
- mService.unregisterCallback(pedInterface);
- ServiceUtil.unBindServiceUtil(mContext, connection);
+ if (isBind && connection != null) {
+ mService.unregisterCallback(pedInterface);
+ mContext.unbindService(connection);
+ }
} catch (Exception e) {
IcLog.e(TAG, "unbindService");
} finally {
}
public void queryPedRecord() {
+ ICLogger.d("queryPedRecord...");
if (mService != null) {
try {
mService.queryPedRecord();
}
- private ServiceConnection connection = new ServiceConnection() {
+ private final ServiceConnection connection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
try {
+ ICLogger.d("bind success...");
mService = IPedRemoteService.Stub.asInterface(service);
mService.registerCallback(pedInterface);
- //queryPedCount();
+ queryPedCount();
} catch (Exception e) {
IcLog.e(TAG, e.getMessage());
}
private IPedAidlInterface.Stub pedInterface = new IPedAidlInterface.Stub() {
@Override
public void updatePedCount(int count) {
+ ICLogger.d("updatePedCount == > " + count);
mObsPedCount.postValue(count);
}
@Override
public void updateCalorie(float count) {
mCalorie.postValue(count);
+ ICLogger.d("updateCalorie == > " + count);
}
@Override