2011-11-21 35 views
0

在Android服务中点击链接时是否有可能捕捉到这种情况。 我知道在服务中捕捉onTouch事件是不可能的。但也许WebBrowser开始是可能的?请帮忙!很重要。 我需要在点击特定链接时启动我的基于Web的应用程序。从服务中开始捕捉浏览器Android

回答

1

活动可以注册到使用URL开始,你在定义你的清单

<activity android:name=".YourActivity"> 
      <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="yourscheme" /> 
      </intent-filter> 
     </activity> 

如果一个看起来像yourscheme://something链接被点击

+0

非常感谢您的活动随后将陆续推出!正是我需要的! – devworkstation

+0

还有一个问题 - 我可以把我的主机值放在标签以某种方式programaticaly? – devworkstation

+0

是的 - 查看http://developer.android.com/guide/topics/manifest/data-element.html – FunkTheMonk