@@ -5,7 +5,33 @@ openinstall插件封装了openinstall平台原生SDK,集成了 **渠道统计,
5
5
使用openinstall可实现以下多种场景:
6
6
![ 实现场景] ( https://res.cdn.openinstall.io/doc/scene.jpg )
7
7
8
- ## 一、配置
8
+ ## 一、安装
9
+
10
+ ### 1. 添加依赖
11
+ 在项目的 ` pubspec.yaml ` 文件中添加以下内容:
12
+
13
+ ``` json
14
+ dependencies:
15
+ openinstall_flutter_plugin: ^2.1.2
16
+ ```
17
+
18
+ ### 2. 安装插件
19
+ 使用命令行获取
20
+
21
+ ``` shell
22
+ $ flutter pub get
23
+ ```
24
+
25
+ 或者使用开发工具的 ` flutter pub get `
26
+
27
+ ### 3. 导入
28
+ 在 ` Dart ` 代码中使用以下代码导入:
29
+
30
+ ``` dart
31
+ import 'package:openinstall_flutter_plugin/openinstall_flutter_plugin.dart';
32
+ ```
33
+
34
+ ## 二、配置
9
35
前往 [ openinstall控制台] ( https://developer.openinstall.io/ ) 创建应用并获取 openinstall 为应用分配的` appkey ` 和 ` scheme ` 以及 iOS的关联域名(Associated Domains)
10
36
![ appkey和scheme] ( https://res.cdn.openinstall.io/doc/ios-appkey.png )
11
37
@@ -83,99 +109,19 @@ Xcode中快速添加:
83
109
![ 添加associatedDomains] ( https://res.cdn.openinstall.io/doc/ios-associated-domains.png )
84
110
85
111
** 注意:插件版本>=1.3.1开始,iOS通用链接原生代码已在插件内部完成**
86
- 1) 1.3.1之前版本升级后可不做任何改动
87
- 2)首次集成插件的用户,如果拉起无法获取到参数,是因为方法被其它插件覆盖导致(openinstall插件不会覆盖其它插件),可以有两种方法解决:
88
- - 第一种方法,提早加载openinstall插件,无效的话使用第二种方法
89
- - 第二种方法,将所有插件的拉起代理方法的逻辑,统一在AppDelegate文件中来处理,代码如下:
90
112
91
- 在头部引入
92
- ``` objc
93
- // 如果是swift,请在桥接文件(一般命名为XXX-Bridging-Header.h)中引入
94
- #import < openinstall_flutter_plugin/OpeninstallFlutterPlugin.h>
95
-
96
- ```
97
- 添加如下方法
98
- ``` objc
99
- - (BOOL )application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
100
- //处理通过openinstall一键唤起App时传递的数据
101
- [OpeninstallFlutterPlugin continueUserActivity:userActivity];
102
- //其他第三方回调:
103
- return YES;
104
- }
105
- ```
106
- swift代码:
107
- ``` swift
108
- // swift4.2之前版本
109
- func application (_ application : UIApplication, continue userActivity : NSUserActivity, restorationHandler : @escaping ([Any ]? ) -> Void ) -> Bool {
110
- // 处理通过openinstall一键唤起App时传递的数据
111
- OpeninstallFlutterPlugin.continue (userActivity)
112
- // 其他第三方回调:
113
- return true
114
- }
115
- // swift4.2版本开始,系统方法修改为:
116
- func application (_ application : UIApplication, continue userActivity : NSUserActivity, restorationHandler : @escaping ([UIUserActivityRestoring]? ) -> Void ) -> Bool {
117
- // 处理通过openinstall一键唤起App时传递的数据
118
- OpeninstallFlutterPlugin.continue (userActivity)
119
- // 其他第三方回调:
120
- return true
121
- }
122
- ```
113
+ 如果拉起无法获取到参数,可能是因为方法被其它插件覆盖导致(openinstall插件不会覆盖其它插件),可以修改其它插件通用链接delegate回调` ..userActivity.. ` 方法` return NO; ` 来解决,可参考OpeninstallFlutterPlugin.m文件相关内容。
123
114
124
115
##### scheme 配置
125
116
添加应用对应的 scheme,可在工程“TARGETS -> Info -> URL Types” 里快速添加,图文请看
126
117
127
118
![ scheme配置] ( https://res.cdn.openinstall.io/doc/ios-scheme.png )
128
119
129
120
** 注意:插件版本>=1.3.1开始,iOS通用链接原生代码已在插件内部完成**
130
- 1) 1.3.1之前版本升级后可不做任何改动
131
- 2)首次集成插件的用户,如果拉起无法获取到参数,是因为方法被其它插件覆盖导致(openinstall插件不会覆盖其它插件),可以有两种方法解决:
132
- - 第一种方法,提早加载openinstall插件,无效的话使用第二种方法
133
- - 第二种方法,将所有插件的拉起代理方法的逻辑,统一在AppDelegate文件中来处理,代码如下:
134
-
135
- 在 ` ios/Runner/AppDelegate.m ` 中头部引入:
136
- ``` objc
137
- // 如果是swift,请在桥接文件(一般命名为XXX-Bridging-Header.h)中引入
138
- #import < openinstall_flutter_plugin/OpeninstallFlutterPlugin.h>
139
- ```
140
-
141
- 在 ` ios/Runner/AppDelegate.m ` 中添加方法:
142
121
143
- ``` objc
144
- // 适用目前所有iOS版本
145
- -(BOOL )application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id )annotation{
146
- //判断是否通过OpenInstall URL Scheme 唤起App
147
- [OpeninstallFlutterPlugin handLinkURL:url];
148
- //其他第三方回调;
149
- return YES;
150
- }
151
-
152
- // iOS9以上,会优先走这个方法
153
- - (BOOL )application:(UIApplication *)app openURL:(NSURL *)url options:(nonnull NSDictionary *)options{
154
- //判断是否通过OpenInstall URL Scheme 唤起App
155
- [OpeninstallFlutterPlugin handLinkURL:url];
156
- //其他第三方回调;
157
- return YES;
158
- }
159
- ```
160
-
161
- swift代码:
162
- ``` swift
163
- // swift引用OC方法时,最好根据系统代码提示来写
164
- // 适用目前所有iOS版本
165
- func application (_ application : UIApplication, handleOpen url : URL) -> Bool {
166
- OpeninstallFlutterPlugin.handLinkURL (url)
167
- return true
168
- }
169
- // iOS9以上,会优先走这个方法
170
- func application (_ app : UIApplication, open url : URL, options : [UIApplicationOpenURLOptionsKey : Any ] = [: ]) -> Bool {
171
- OpeninstallFlutterPlugin.handLinkURL (url)
172
- return true
173
- }
174
- // 注意,swift4.2版本开始,系统方法修改为:
175
- func application (_ app : UIApplication, open url : URL, options : [UIApplication.OpenURLOptionsKey : Any ] = [: ]) -> Bool {}
176
- ```
122
+ 如果拉起无法获取到参数,可能是因为方法被其它插件覆盖导致(openinstall插件不会覆盖其它插件),可以修改其它插件通用链接delegate回调` ..hanldeOpenURL.. ` 方法` return NO; ` 来解决,可参考OpeninstallFlutterPlugin.m文件相关内容。
177
123
178
- ## 二 、使用
124
+ ## 三 、使用
179
125
180
126
### 初始化
181
127
` init(EventHandler wakeupHandler) `
@@ -264,7 +210,7 @@ _openinstallFlutterPlugin.reportShare("123456", "WechatSession")
264
210
```
265
211
可以通过返回的data中的` shouldRetry ` 决定是否需要重试,以及` message ` 查看失败的原因
266
212
267
- ## 三 、导出apk/ipa包并上传
213
+ ## 四 、导出apk/ipa包并上传
268
214
269
215
集成完毕后,导出iOS/Android安装包上传[ openinstall控制台] ( https://developer.openinstall.io/ ) ,openinstal会检查应用的集成配置
270
216
![ 上传ipa安装包] ( https://res.cdn.openinstall.io/doc/upload-ipa-jump.png )
@@ -276,7 +222,7 @@ _openinstallFlutterPlugin.reportShare("123456", "WechatSession")
276
222
277
223
---
278
224
279
- ## 广告接入补充文档
225
+ ## 五、 广告接入补充文档
280
226
281
227
### Android平台
282
228
1、针对广告平台接入,新增配置接口,在调用 ` init ` 之前调用。参考 [ 广告平台对接Android集成指引] ( https://www.openinstall.io/doc/ad_android.html )
0 commit comments