| | |
| | | */ |
| | | public static boolean isExistsActivity = false; |
| | | /** |
| | | * 小程序是否开启 |
| | | */ |
| | | public static boolean uinEnabled = false; |
| | | /** |
| | | * context |
| | | */ |
| | | private Application mContext; |
| | |
| | | DCUniMPSDK.getInstance().setUniMPOnCloseCallBack(new IUniMPOnCloseCallBack() { |
| | | @Override |
| | | public void onClose(String appid) { |
| | | HDLUniMPSDKManager.uinEnabled=false; |
| | | // if (AppConfigManage.isDebug()) { |
| | | // HdlLogLogic.print("收到小程序通知 被关闭了"); |
| | | // } |
| | |
| | | DCUniMPSDK.getInstance().setOnUniMPEventCallBack(new IOnUniMPEventCallBack() { |
| | | @Override |
| | | public void onUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) { |
| | | HDLUniMPSDKManager.uinEnabled=true; |
| | | // handelUniMPEventReceive(appid, event, data, callback); |
| | | HdlLogLogic.print("收到小程序通知 event=" + event); |
| | | // String processMessage = Process.myPid() + " "; |
| | |
| | | */ |
| | | public Boolean isInitialize() { |
| | | return DCUniMPSDK.getInstance().isInitialize(); |
| | | } |
| | | |
| | | /** |
| | | * 检查当前小程序组件是否正在运行 |
| | | * |
| | | * @return true表示正在运行,false表示未运行 |
| | | */ |
| | | public Boolean isRuning() { |
| | | Log.d(TAG,"isRuning"); |
| | | if (this.getUniMP() == null) { |
| | | return false; |
| | | } |
| | | return this.getUniMP().isRuning(); |
| | | } |
| | | /** |
| | | * 显示已创建的小程序组件 |
| | | * |
| | | * @return 通常与 hideUniMP() 配对使用,用于控制组件的可见性 |
| | | */ |
| | | public Boolean showUniMP() { |
| | | Log.d(TAG,"showUniMP"); |
| | | if (this.getUniMP() == null) { |
| | | return false; |
| | | } |
| | | return this.getUniMP().showUniMP(); |
| | | } |
| | | /** |
| | | * 隐藏当前显示的小程序组件 |
| | | * |
| | | * @return 隐藏后组件仍在后台运行,可以快速重新显示 |
| | | */ |
| | | public Boolean hideUniMP() { |
| | | Log.d(TAG,"hideUniMP"); |
| | | if (this.getUniMP() == null) { |
| | | return false; |
| | | } |
| | | return this.getUniMP().hideUniMP(); |
| | | } |
| | | /** |
| | | * 完全关闭并销毁小程序组件实例(与hide的区别,close会释放资源,而hide只是暂时隐藏) |
| | | * |
| | | * @return |
| | | */ |
| | | public Boolean closeUniMP() { |
| | | Log.d(TAG,"closeUniMP"); |
| | | if (this.getUniMP() == null) { |
| | | return false; |
| | | } |
| | | return this.getUniMP().closeUniMP(); |
| | | } |
| | | |
| | | |
| | |
| | | if (mUniMPCaches.containsKey(uniAppId)) { |
| | | if (mUniMPCaches.get(uniAppId) != null) { |
| | | mUniMPCaches.get(uniAppId).sendUniMPEvent(topic, data); |
| | | HdlLogLogic.print("android---通知---uni---主题:" + topic + "---发送数据:" + new Gson().toJson(data)); |
| | | // HdlLogLogic.print("android---通知---uni---主题:" + topic + "---发送数据:" + new Gson().toJson(data)); |
| | | } else { |
| | | HdlLogLogic.print("android---通知---uni---失败---小程序对象为空:" + uniAppId); |
| | | // HdlLogLogic.print("android---通知---uni---失败---小程序对象为空:" + uniAppId); |
| | | } |
| | | } else { |
| | | // HdlLogLogic.print("Android---通知---uni---失败---¬小程序对象为空:" + uniAppId); |