提交 6ca413dc authored 作者: JarvanMo's avatar JarvanMo

update docs

上级 73db95bd
...@@ -2,22 +2,36 @@ ...@@ -2,22 +2,36 @@
Fluwx supports launch app from `<wx-open-launch-app>`, and pass `extInfo` to your app. Fluwx supports launch app from `<wx-open-launch-app>`, and pass `extInfo` to your app.
For Android side, you need add the following action for your FlutterActivity in `AndroidManifest.xml`: For Android side, you need add the following action for your FlutterActivity in `AndroidManifest.xml`:
``` ```
<action android:name="${applicationId}.FlutterActivity" /> <intent-filter>
<action android:name="${applicationId}.FlutterActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
``` ```
At the same time, you also need to add `<meta-data>` in application which used to store your WeChat AppId:
```xml
<meta-data
android:name="weChatAppId"
android:value="12345678" />
```
If you want to pass `extInfo` to Flutter, you need to add the following code in `MainActivity.kt`: If you want to pass `extInfo` to Flutter, you need to add the following code in `MainActivity.kt`:
```kotlin ```kotlin
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun onCreate(savedInstanceState: Bundle?) {
GeneratedPluginRegistrant.registerWith(flutterEngine); super.onCreate(savedInstanceState)
//If you didn't configure WxAPI, add the following code //If you didn't configure WxAPI, add the following code
WXAPiHandler.setupWxApi("wxd930ea5d5a258f4f",this) WXAPiHandler.setupWxApi("wxd930ea5d5a258f4f",this)
//Get Ext-Info from Intent. //Get Ext-Info from Intent.
FluwxRequestHandler.handleRequestInfoFromIntent(intent) FluwxRequestHandler.handleRequestInfoFromIntent(intent)
} }
``` ```
If you want to custom your request logic, you need add the `<meta-data>` in host activity: If you want to custom your request logic, you need add the `<meta-data>` in application:
```xml ```xml
<meta-data <meta-data
android:name="handleWeChatRequestByFluwx" android:name="handleWeChatRequestByFluwx"
android:value="flase" /> android:value="flase" />
``` ```
And then, set `FluwxRequestHandler.customOnReqDelegate` on your own. And then, set `FluwxRequestHandler.customOnReqDelegate` on your own.
\ No newline at end of file
> For details, please read the example.
\ No newline at end of file
## 从H5启动app ## 从H5启动app
Fluwx 支持从`<wx-open-launch-app>`启动你的app, 并且支持传递`extInfo`给你的app. Fluwx 支持从`<wx-open-launch-app>`启动你的app, 并且支持传递`extInfo`给你的app.
对于Android来说,你要在`AndroidManifest.xml`中给你的`application`加上一个标签: 对于Android来说,你要在`AndroidManifest.xml`中给你的`Activity`加上一个标签:
``` ```
<intent-filter>
<action android:name="${applicationId}.FlutterActivity" /> <action android:name="${applicationId}.FlutterActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
``` ```
与此同时,你还需要在需要在application中加上`<meta-data>`,把你的appId放进去:
```xml
<meta-data
android:name="weChatAppId"
android:value="12345678" />
```
如果你想把`extInfo`传给Flutter, 你要在`MainActivity`加上如下代码: 如果你想把`extInfo`传给Flutter, 你要在`MainActivity`加上如下代码:
```kotlin ```kotlin
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun onCreate(savedInstanceState: Bundle?) {
GeneratedPluginRegistrant.registerWith(flutterEngine); super.onCreate(savedInstanceState)
//If you didn't configure WxAPI, add the following code //If you didn't configure WxAPI, add the following code
WXAPiHandler.setupWxApi("wxd930ea5d5a258f4f",this) WXAPiHandler.setupWxApi("wxd930ea5d5a258f4f",this)
//Get Ext-Info from Intent. //Get Ext-Info from Intent.
...@@ -20,4 +33,6 @@ Fluwx 支持从`<wx-open-launch-app>`启动你的app, 并且支持传递`extInfo ...@@ -20,4 +33,6 @@ Fluwx 支持从`<wx-open-launch-app>`启动你的app, 并且支持传递`extInfo
android:name="handleWeChatRequestByFluwx" android:name="handleWeChatRequestByFluwx"
android:value="flase" /> android:value="flase" />
``` ```
然后, 自己实现 `FluwxRequestHandler.customOnReqDelegate`. 然后, 自己实现 `FluwxRequestHandler.customOnReqDelegate`.
\ No newline at end of file
> 更多信息请参考example.
\ No newline at end of file
...@@ -28,9 +28,11 @@ ...@@ -28,9 +28,11 @@
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="${applicationId}.FlutterActivity" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
<intent-filter>
<action android:name="${applicationId}.FlutterActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论