Skip to content

Commit

Permalink
调整文档
Browse files Browse the repository at this point in the history
调整文档
  • Loading branch information
DangerousDON authored and DangerousDON committed Jun 14, 2017
1 parent c9943d9 commit 1b94413
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions README.md
Expand Up @@ -54,46 +54,50 @@ MobLink.onRestoreScene += sceneHandler;

1. 配置scheme:
Android平台的scheme是在AndroidManifest里配置的,需要在Activity的声明处增加如下配置:

```
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="mlink" android:host="com.mob.moblink.demo">
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="mlink" android:host="com.mob.moblink.demo">
</intent-filter>
```
scheme和host都由您自己定义(最好是唯一的),但要与后端配置保持一致。
AppLinks配置(AppLinks的支持从SDK-v1.1.0开始支持)

```
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" android:host="70r9.ulml.mob.com" />
<data android:scheme="https" android:host="70r9.ulml.mob.com" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" android:host="70r9.ulml.mob.com" />
<data android:scheme="https" android:host="70r9.ulml.mob.com" />
</intent-filter>
```
这里的scheme只能是http或者https, host请从后端配置里读取
![aaaa](http://wiki.mob.com/wp-content/uploads/2017/02/aaaa.png)

2. 在所有Scene中增加如下代码

```
#if UNITY_ANDROID
protected virtual void OnApplicationPause(bool pauseStatus)
{
// 您应该复制这段代码 -> 您的实现方法里.
if (!pauseStatus) {
MobLink.updateIntent ();
}
#if UNITY_ANDROID
protected virtual void OnApplicationPause(bool pauseStatus)
{
// 您应该复制这段代码 -> 您的实现方法里.
if (!pauseStatus) {
MobLink.updateIntent ();
}
#endif
}
#endif
```

3. 仅当你的Activity的launchMode为singleTop时,您才需要这样处理(Android代码)

```
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
```


Expand Down

0 comments on commit 1b94413

Please sign in to comment.