我已经研究了大多数自定义URL方案问答,但我没有找到可能的答案.
我想通过点击浏览器中的某个URL(移动设备上的任何一个)来启动我的应用程序,问题是我的给定URL无法修改,因为它也提供IOS应用程序,它看起来像这样:
"myapp:// http://www.name.com/path/path2/ "
我不知道如何处理"myapp:// http://"并构建一个正确的意图过滤器,我尝试的一切都行不通.任何帮助将不胜感激,如果我错过了相关的答案,请不要道歉.
这是我到目前为止所尝试的:
<activity
android:name="com.myapp.test.SplashScreen"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Test for URL scheme -->
<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:host="www.name.com"
android:path="/path/path2/"
android:scheme="http" />
<data
android:host="www.name.com"
android:path="/path/path2/"
android:scheme="https" />
<data android:scheme="myapp" />
</intent-filter>
<!-- End Test for URL scheme -->
</activity>
Run Code Online (Sandbox Code Playgroud)
注意:我尝试使用/不使用导出:true