|
|
|
@ -11,6 +11,8 @@ import android.content.ComponentName;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
|
import android.net.ConnectivityManager;
|
|
|
|
|
import android.os.BatteryManager;
|
|
|
|
|
import android.os.Environment;
|
|
|
|
@ -109,6 +111,10 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
private String mModelName = null;
|
|
|
|
|
|
|
|
|
|
private String mMpAppVersion = null;
|
|
|
|
|
|
|
|
|
|
private String mMpMasterVersion = null;
|
|
|
|
|
|
|
|
|
|
public MpMasterService() {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
@ -120,6 +126,16 @@ public class MpMasterService extends Service {
|
|
|
|
|
public void onCreate() {
|
|
|
|
|
super.onCreate();
|
|
|
|
|
|
|
|
|
|
mMpMasterVersion = MicroPhotoContext.getVersionName(getApplicationContext());
|
|
|
|
|
PackageManager packageManager = getPackageManager();
|
|
|
|
|
PackageInfo packageInfo = null;
|
|
|
|
|
try {
|
|
|
|
|
packageInfo = packageManager.getPackageInfo(MicroPhotoContext.PACKAGE_NAME_MPAPP, 0);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
mMpAppVersion = packageInfo == null ? "" : packageInfo.versionName;
|
|
|
|
|
|
|
|
|
|
mHander = new ServiceHandler();
|
|
|
|
|
|
|
|
|
|
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
|
|
|
@ -175,6 +191,14 @@ public class MpMasterService extends Service {
|
|
|
|
|
return mCmdid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getMpAppVersion() {
|
|
|
|
|
return mMpAppVersion;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getMasterAppVersion() {
|
|
|
|
|
return mMpMasterVersion;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void sendMessage(Context context, int what, int data) {
|
|
|
|
|
Intent intent = new Intent(ACTION_MSG_BROADCAST);
|
|
|
|
|
intent.putExtra("what", what);
|
|
|
|
|