如果应用未在后台运行,则深层链接操作无效

时间:2018-06-14 12:59:55

标签: android deep-linking

<activity android:name=".XActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:noHistory="true"
        android:launchMode="singleTask" >

        <intent-filter>
            <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="x.lv" />
            <data android:scheme="http" android:host="www.x.lv" />
            <data android:scheme="https" android:host="m.x.lv" />
        </intent-filter>

    </activity>

AND

public class XActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = getIntent(); [Debugger break-point]
        if (intent == null || intent.getData() == null) {
            finish();
        }

    }
}

好吧,如果我的应用程序从deep-link 开始,如果应用程序在后台运行,我会直到该部分。如果我关闭我的应用程序然后点击deep-link,那么应用程序就会打开,但我没有使用调试器点击onCreate方法。为什么会这样?即使应用程序处于离线/关闭状态,我认为它应该也能正常工作。

0 个答案:

没有答案
相关问题