| | |
| | | package com.hdl.photovoltaic.uni;
|
| | |
|
| | | import android.app.Activity;
|
| | | import android.content.ComponentName;
|
| | | import android.content.Context;
|
| | | import android.content.Intent;
|
| | | import android.content.ServiceConnection;
|
| | | import android.os.IBinder;
|
| | | import android.os.SystemClock;
|
| | | import android.util.Log;
|
| | | import android.view.LayoutInflater;
|
| | | import android.view.View;
|
| | | import android.view.ViewGroup;
|
| | |
|
| | | import com.hdl.photovoltaic.HDLApp;
|
| | | import com.hdl.photovoltaic.IUniappAidlInterface;
|
| | | import com.hdl.photovoltaic.R;
|
| | | import com.hdl.photovoltaic.config.UserConfigManage;
|
| | | import com.hdl.photovoltaic.utils.ProcessManagerUtils;
|
| | |
|
| | | import java.lang.ref.WeakReference;
|
| | |
|
| | | import io.dcloud.feature.sdk.Interface.IDCUniMPAppSplashView;
|
| | |
|
| | |
| | | }
|
| | | } catch (Exception ignored) {
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //只能通过这种方式调用
|
| | | Intent intent = new Intent();
|
| | | intent.setPackage("com.hdl.photovoltaic");
|
| | | intent.setAction("UniappService.ACTION");
|
| | | context.bindService(intent, stringservice, Context.BIND_AUTO_CREATE);
|
| | |
|
| | | return splashView;
|
| | | }
|
| | |
|
| | |
|
| | | static ServiceConnection stringservice = new ServiceConnection() {
|
| | | private WeakReference<Context> contextWeakReference;
|
| | | @Override
|
| | | public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
| | | IUniappAidlInterface iUniappAidlInterface = IUniappAidlInterface.Stub.asInterface(iBinder);
|
| | | try {
|
| | | iUniappAidlInterface.sendMsg("建立连接");
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onServiceDisconnected(ComponentName componentName) {
|
| | | Log.i("BSplashView", "连接已断开");
|
| | | Context context = contextWeakReference.get();
|
| | | ProcessManagerUtils.killAllProcess(contextWeakReference.get());
|
| | | }
|
| | |
|
| | | public void setContextWeakReference(WeakReference<Context> contextWeakReference) {
|
| | | this.contextWeakReference = contextWeakReference;
|
| | | }
|
| | | };
|
| | |
|
| | | @Override
|
| | | public void onCloseSplash(ViewGroup rootView) {
|
| | | if (rootView != null)
|