| | |
| | | package com.hdl.photovoltaic.uni;
|
| | |
|
| | | import android.app.Activity;
|
| | | import android.app.ActivityManager;
|
| | | import android.content.ComponentName;
|
| | | import android.content.Context;
|
| | | import android.content.Intent;
|
| | |
| | | import com.hdl.photovoltaic.utils.ProcessManagerUtils;
|
| | |
|
| | | import java.lang.ref.WeakReference;
|
| | | import java.util.List;
|
| | |
|
| | | import io.dcloud.feature.sdk.Interface.IDCUniMPAppSplashView;
|
| | |
|
| | |
| | | //设置导航条背景颜色
|
| | | Activity activity = (Activity) context;
|
| | | activity.getWindow().setNavigationBarColor(HDLApp.getInstance().getColor(R.color.text_FF1C1C1E));
|
| | | //只能通过这种方式调用
|
| | | Intent intent = new Intent();
|
| | | intent.setPackage("com.hdl.photovoltaic");
|
| | | intent.setAction("UniappService.ACTION");
|
| | | context.bindService(intent, stringservice, Context.BIND_AUTO_CREATE);
|
| | |
|
| | | // //只能通过这种方式调用
|
| | | // Intent intent = new Intent();
|
| | | // 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;
|