{"rsdb":{"rid":"380425","subhead":"","postdate":"0","aid":"265784","fid":"100","uid":"1","topic":"1","content":"
\n

\u7248\u672c\u53f70.1.54
\u770b\u6e90\u7801\u4e4b\u524d\uff0c\u6211\u5148\u53bb\u770b\u4e0b\u5b98\u65b9\u6587\u6863\uff0c\u5bf9\u4e8e\u5176\u6e90\u7801\u7684\u8bbe\u8ba1\u8bf4\u660e\uff0c\u6587\u4e2d\u6240\u8bf4\u7684\u539f\u751f\u90fd\u662f\u6307android<\/p> \n

\u770b\u5b8c\u5b98\u65b9\u6587\u6863\u7684\u8bf4\u660e\uff0c\u6211\u6709\u4ee5\u4e0b\u51e0\u4e2a\u7591\u95ee<\/p> \n

\n

\u7b2c\u4e00\u4e2a\uff1a\u5bb9\u5668\u662f\u600e\u4e48\u8bbe\u8ba1\u7684\uff1f<\/p> \n <\/blockquote> \n

\n

\u7b2c\u4e8c\u4e2a\uff1anative\u548cflutter\u7684channel\u7684\u901a\u9053\u662f\u5982\u4f55\u8bbe\u8ba1\u7684\uff1f<\/p> \n <\/blockquote> \n

\n

\u7b2c\u4e09\u4e2a\uff1aFlutter\u662f\u9002\u914d\u5c42\u5230\u5e95\u518d\u505a\u4e9b\u4ec0\u4e48\uff1f<\/p> \n <\/blockquote> \n

\u4e2d\u63a7\u4e2d\u5fc3FlutterBoost<\/h2> \n

\u5355\u72ec\u62ce\u51fa\u6765\u8bb2\u8bb2\uff0c\u8fd9\u4e2a\u7c7b\u6bd4\u8f83\u7b80\u5355\uff0c\u5c31\u662f\u96c6\u5408\u5404\u4e2a\u6a21\u5757\u5e76\u8ba9\u5176\u521d\u59cb\u5316\uff0c\u540c\u65f6\u4e5f\u662f\u8be5\u63d2\u4ef6\u5165\u53e3\u5904\uff0c\u4e0d\u7ba1\u539f\u751f\u548cflutter\u90fd\u4e00\u6837\uff0c\u770b\u6e90\u7801\u4e5f\u662f\u4ece\u8fd9\u91cc\u5f00\u59cb\u770b\u8d77\uff0c\u4f46\u539f\u751f\u548cflutter\u7684\u521d\u59cb\u5316\u6d41\u7a0b\u7a0d\u5fae\u6709\u5c11\u8bb8\u533a\u522b\uff0c\u4e3b\u8981\u8fd8\u662f\u56e0\u4e3a\u539f\u751f\u662f\u4f5c\u4e3a\u5bb9\u5668\uff0cflutter\u7684\u5bb9\u5668\u662f\u4f9d\u8d56\u4e8e\u539f\u751f\u5bb9\u5668\u3002<\/p> \n

\u539f\u751finit<\/h3> \n

\u5165\u53e3\uff1a\/flutter_boost\/example\/android\/app\/src\/main\/java<\/a>\/com\/taobao\/idlefish\/flutterboostexample\/MyApplication.java<\/a><\/p> \n

FlutterBoost.init\u4ece\u8fd9\u91cc\u5f00\u59cb\u8fdb\u5165<\/p> \n

 FlutterBoost.init(new Platform() {\r\n\r\n            @Override\r\n            public Application getApplication() {\r\n                return MyApplication.this;\r\n            }\r\n\r\n            @Override\r\n            public boolean isDebug() {\r\n                return true;\r\n            }\r\n\r\n            @Override\r\n            public void openContainer(Context context, String url, Map<String, Object> urlParams, int requestCode, Map<String, Object> exts) {\r\n                PageRouter.openPageByUrl(context, url, urlParams, requestCode);\r\n            }\r\n\r\n            @Override\r\n            public IFlutterEngineProvider engineProvider() {\r\n                \/\/\u6ce8\u610f\u8fd9\u91cc  \u8986\u5199\u4e86createEngine\r\n                return new BoostEngineProvider() {\r\n                    @Override\r\n                    public BoostFlutterEngine createEngine(Context context) {\r\n                        return new BoostFlutterEngine(context, new DartExecutor.DartEntrypoint(\r\n                                context.getResources().getAssets(),\r\n                                FlutterMain.findAppBundlePath(context),\r\n                                "main"), "\/");\r\n                    }\r\n                };\r\n            }\r\n\r\n            @Override\r\n            public int whenEngineStart() {\r\n                return ANY_ACTIVITY_CREATED;\r\n            }\r\n        });\r\n\r\n        BoostChannel.addActionAfterRegistered(new BoostChannel.ActionAfterRegistered() {\r\n            @Override\r\n            public void onChannelRegistered(BoostChannel channel) {\r\n                \/\/platform view register should use FlutterPluginRegistry instread of BoostPluginRegistry\r\n                TextPlatformViewPlugin.register(FlutterBoost.singleton().engineProvider().tryGetEngine().getPluginRegistry());\r\n            }\r\n        });\r\n    }\r\n<\/code><\/pre> \n 

\u4e0a\u9762\u5927\u90e8\u5206\u65b9\u6cd5\uff0c\u505a\u8fc7android\u4e5f\u77e5\u9053\u662f\u5e72\u561b\u7684\uff0c\u8fd9\u91cc\u91cd\u70b9\u8bb2\u8bb2IFlutterEngineProvider\u8fd9\u4e2a\u63a5\u53e3\uff0c\u8fd9\u91cc\u67093\u4e2a\u65b9\u6cd5\uff0c\u5982\u4e0b<\/p> \n

\/**\r\n * a flutter engine provider\r\n *\/\r\npublic interface IFlutterEngineProvider {\r\n\r\n    \/**\r\n     * create flutter engine, we just hold a single instance now\r\n     * @param context\r\n     * @return\r\n     *\/\r\n    BoostFlutterEngine createEngine(Context context);\r\n\r\n    \/**\r\n     * provide a flutter engine\r\n     * @param context\r\n     * @return\r\n     *\/\r\n    BoostFlutterEngine provideEngine(Context context);\r\n\r\n    \/**\r\n     * may return null\r\n     * @return\r\n     *\/\r\n    BoostFlutterEngine tryGetEngine();\r\n}\r\n\r\n<\/code><\/pre> \n 

\u62bd\u8c61\u6210\u63a5\u53e3\uff0c\u6839\u636e\u9879\u76ee\u7684\u5b9e\u9645\u60c5\u51b5\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u81ea\u5df1\u5b9e\u73b0flutter\u5f15\u64ce\uff0c\u6216\u91c7\u7528\u5b98\u65b9\u6e90\u7801\u91cc\u81ea\u5df1\u7684\u5b9e\u73b0\u7c7b\u5373BoostEngineProvider\uff0c\u4f46\u60f3\u4e0d\u660e\u767d createEngine \u548cprovideEngine \u5230\u5e95\u6709\u4f55\u533a\u522b\uff0c\u5230\u5e95\u4e3a\u4f55\u5f04\u6210\u4e24\u4e2a\u65b9\u6cd5\uff0c\u4e0d\u5c31\u662f\u4e2a\u63d0\u4f9b\u4e2aflutter\u5f15\u64ce\u5b9e\u4f8b\u5417\uff1f<\/p> \n

\u770b\u4e86\u4e0bcreateEngine\u7684\u5b9e\u73b0\uff0c\u4e3b\u8981\u52a0\u8f7d\u5b9e\u4f8bBoostFlutterEngine\uff0c\u8fd9\u4e2a\u5b9e\u4f8b\u770b\u540d\u5b57\u4e5f\u6e05\u695a\u662f\u8fdb\u884cflutter\u5f15\u64ce\u7684\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u4e86dart\u9ed8\u8ba4\u5165\u53e3\u70b9\u5373main\uff0c\u8bbe\u7f6e\u4e86\u8def\u7531\u8d77\u70b9\u53ca\u63d2\u4ef6\u7684\u58f0\u660e\u6ce8\u518c\u4e00\u7c7b
\u7136\u540e\u53bb\u770bprovideEngine\u65b9\u6cd5\u7684\u5b9e\u73b0\uff0c\u4ee3\u7801\u8f83\u5c11\uff0c\u5982\u4e0b<\/p> \n

   @Override\r\n    public BoostFlutterEngine provideEngine(Context context) {\r\n        Utils.assertCallOnMainThread();\r\n\r\n        if (mEngine == null) {\r\n            FlutterShellArgs flutterShellArgs = new FlutterShellArgs(new String[0]);\r\n            FlutterMain.ensureInitializationComplete(\r\n                    context.getApplicationContext(), flutterShellArgs.toArray());\r\n\r\n            mEngine = createEngine(context.getApplicationContext());\r\n\r\n            final IStateListener stateListener = FlutterBoost.sInstance.mStateListener;\r\n            if(stateListener != null) {\r\n                stateListener.onEngineCreated(mEngine);\r\n            }\r\n        }\r\n        return mEngine;\r\n    }\r\n<\/code><\/pre> \n 

\u521d\u59cb\u5316flutter\u53c2\u6570\u53ca\u589e\u52a0\u4e00\u4e2a\u56de\u8c03\uff0c\u6ca1\u4ec0\u4e48\u7279\u522b\u4e4b\u5904\uff0c\u7136\u540e\u53bb\u7ffb\u4e86\u4e0bflutter.jar\u7684FlutterActivity\u6e90\u7801\uff0c\u5b83\u7684flutter\u5f15\u64ce\u521d\u59cb\u5316\u6700\u540e\u662f\u8ffd\u8e2a\u5230FlutterFragment\uff0c\u5173\u952e\u4ee3\u7801\u5982\u4e0b","orderid":"0","title":"flutter_boot android\u548cflutter\u6e90\u7801\u9605\u8bfb\u8bb0\u5f55(\u4e00)","smalltitle":"","mid":"0","fname":"\u5176\u5b83","special_id":"0","bak_id":"0","info":"0","hits":"43","pages":"10","comments":"0","posttime":"2019-11-15 18:38:55","list":"1573814335","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"flutter_boot<\/A> android<\/A> flutter<\/A> \u6e90\u7801<\/A> \u9605\u8bfb<\/A> \u8bb0\u5f55<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.34","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"flutter_boot android\u548cflutter\u6e90\u7801\u9605\u8bfb\u8bb0\u5f55","lastview":"1576024453","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}