简体   繁体   English

Android Intent过滤器无法从浏览器启动活动

[英]Android intent filter not working to launch activity from browser

I've read a tutorial on how to launch an app from a link on the browser. 我已经阅读了有关如何通过浏览器上的链接启动应用程序的教程。 I've created an activity 'TestLaunch'. 我创建了一个活动“ TestLaunch”。

 <activity
        android:name=".TestMe"
        android:label="Test">
        <intent-filter>
            <data android:scheme="testme.com" />
            <action android:name="android.intent.action.VIEW" />
        </intent-filter>

</activity>

Then I connected my android phone and clicked 'debug' on Eclipse. 然后,我连接了我的Android手机并在Eclipse上单击“调试”。 The app launched as usual. 该应用程序照常启动。 I openned the browser and typed 'testme.com'. 我打开浏览器,然后输入“ testme.com”。 The activity was not started as expected. 该活动未按预期启动。 Is this because the app is not fully installed on the phone or because I am understanding wrongly how the intent filter works? 这是因为该应用程序尚未完全安装在手机上,还是因为我误解了意图过滤器的工作原理?

try this: 尝试这个:

 <activity
    android:name=".TestMe"
    android:label="Test">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT"></category>
        <category android:name="android.intent.category.BROWSABLE"></category>
        <data android:host="www.testme.com" android:scheme="http"></data>
    </intent-filter>
 </activity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM