|
|
@ -148,6 +148,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
private static final String EXTRA_PARAM_TIME = "Time";
|
|
|
|
private static final String EXTRA_PARAM_TIME = "Time";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String FOREGROUND_CHANNEL_ID = "fg_mpapp";
|
|
|
|
private static final String FOREGROUND_CHANNEL_ID = "fg_mpapp";
|
|
|
|
|
|
|
|
private HeartBeatResponseReceiver mHeartBeatReceiver;
|
|
|
|
|
|
|
|
|
|
|
|
public static class STATE_SERVICE {
|
|
|
|
public static class STATE_SERVICE {
|
|
|
|
public static final int CONNECTED = 10;
|
|
|
|
public static final int CONNECTED = 10;
|
|
|
@ -323,6 +324,14 @@ public class MicroPhotoService extends Service {
|
|
|
|
getApplicationContext().registerReceiver(mNetworkChangedReceiver, filter);
|
|
|
|
getApplicationContext().registerReceiver(mNetworkChangedReceiver, filter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mHeartBeatReceiver = new HeartBeatResponseReceiver();
|
|
|
|
|
|
|
|
IntentFilter filter = new IntentFilter();
|
|
|
|
|
|
|
|
filter.addAction("com.systemui.ACTION_HEARTBEAT_RESPONSE");
|
|
|
|
|
|
|
|
getApplicationContext().registerReceiver(mHeartBeatReceiver, filter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
AlarmManager alarmManager = (AlarmManager) getApplicationContext().getSystemService(ALARM_SERVICE);
|
|
|
|
AlarmManager alarmManager = (AlarmManager) getApplicationContext().getSystemService(ALARM_SERVICE);
|
|
|
|
|
|
|
|
|
|
|
@ -353,6 +362,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
getApplicationContext().unregisterReceiver(mAlarmReceiver);
|
|
|
|
getApplicationContext().unregisterReceiver(mAlarmReceiver);
|
|
|
|
getApplicationContext().unregisterReceiver(mScreenaAtionReceiver);
|
|
|
|
getApplicationContext().unregisterReceiver(mScreenaAtionReceiver);
|
|
|
|
getApplicationContext().unregisterReceiver(mNetworkChangedReceiver);
|
|
|
|
getApplicationContext().unregisterReceiver(mNetworkChangedReceiver);
|
|
|
|
|
|
|
|
getApplicationContext().unregisterReceiver(mHeartBeatReceiver);
|
|
|
|
|
|
|
|
|
|
|
|
if (mConnectivityManager != null) {
|
|
|
|
if (mConnectivityManager != null) {
|
|
|
|
if (mNetworkCallback != null) {
|
|
|
|
if (mNetworkCallback != null) {
|
|
|
@ -501,10 +511,10 @@ public class MicroPhotoService extends Service {
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intent heartintent = new Intent("com.xy.xsetting.action");
|
|
|
|
Intent responseIntent = new Intent("com.systemui.ACTION_HEARTBEAT_RESPONSE");
|
|
|
|
heartintent.putExtra("cmd", "heartbeat");
|
|
|
|
responseIntent.putExtra("timestamp",System.currentTimeMillis());
|
|
|
|
heartintent.setPackage("com.android.systemui");
|
|
|
|
context.sendBroadcast(responseIntent);
|
|
|
|
context.sendBroadcast(heartintent);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) {
|
|
|
|
} else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) {
|
|
|
|
long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0);
|
|
|
|
long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0);
|
|
|
|