日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

獲取小程序棧堆和當前信息

您可以按照以下步驟,獲取小程序棧堆和當前信息。

  1. 創(chuàng)建 CustomApiBridgeExtension 類繼承 SimpleBridgeExtension 類。代碼示例如下:

    public class CustomApiBridgeExtension extends SimpleBridgeExtension {
    
        private static final String TAG = "CustomApiBridgeExtension";
    
        @ActionFilter
        public void tinyToNative(@BindingId String id,
                                 @BindingNode(App.class) App app,
                                 @BindingNode(Page.class) Page page,
                                 @BindingApiContext ApiContext apiContext,
                                 @BindingExecutor(ExecutorType.UI) Executor executor,
                                 @BindingRequest JSONObject params,
                                 @BindingParam("param1") String param1,
                                 @BindingParam("param2") String param2,
                                 @BindingCallback BridgeCallback callback) {
            RVLogger.d(TAG, "id: " + id +
                    "\napp: " + app.toString() +
                    "\npage: " + page.toString() +
                    "\napiContext: " + apiContext.toString() +
                    "\nexecutor: " + executor.toString());
            RVLogger.d(TAG, JSONUtils.toString(params));
    
            JSONObject result = BridgeResponse.SUCCESS.get();
    
            // 將結(jié)果返回給小程序
    
            Stack stack = MriverApp.getAppStack();
            Enumeration enumerationLists = stack.elements();
    
    
            JSONArray jsonArray = new JSONArray();
            while (enumerationLists.hasMoreElements()) {
                JSONObject jsonObject = new JSONObject();
                MRApp o = (MRApp) enumerationLists.nextElement();
                jsonObject.put("AppId", o.getAppId());
                jsonObject.put("AppVersion", o.getAppVersion());
                jsonArray.add(jsonObject);
            }
            String tinyappStr = jsonArray.toJSONString();
            // result.put("message", "客戶端接收到參數(shù):" + param1 + ", " + param2 + "\n返回 Demo 當前包名:" + apiContext.getActivity().getPackageName());
            result.put("message", tinyappStr);
            callback.sendJSONResponse(result);
        }
    
    }
    
  2. 在啟動小程序之前進行注冊。

    MriverEngine.registerBridge(CustomApiBridgeExtension.class);
  3. 啟動小程序。

    Mriver.startApp(activity, "2021042620210426");