| | |
| | | // intent.setPackage("com.hdl.photovoltaic");
|
| | | // intent.setAction("UniappService.ACTION");
|
| | | // context.bindService(intent, stringservice, Context.BIND_AUTO_CREATE);
|
| | |
|
| | | return splashView;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 关闭当前应用进程
|
| | | *
|
| | | * @param context
|
| | | */
|
| | | public void killProcessByPackName(Context context) {
|
| | | if (context == null) {
|
| | | return;
|
| | | }
|
| | | final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
| | | List<ActivityManager.RunningAppProcessInfo> procList = am.getRunningAppProcesses();
|
| | | for (ActivityManager.RunningAppProcessInfo proc : procList) {
|
| | | if (proc.processName != null && proc.processName.equals(context.getPackageName())) {
|
| | | android.os.Process.killProcess(proc.pid);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | static ServiceConnection stringservice = new ServiceConnection() {
|
| | | private WeakReference<Context> contextWeakReference;
|