2012-07-26 22 views
2

我想获得一个Web URL来打开/启动我的应用程序的活动,但它不工作。该URL类似于下面的内容:“absdi24”使用意图与计划启动应用程序Android

我只需要链接识别最多的“激活”点

https://zzz.yyy.com/activate?user=“123123123” &令牌=。我把我的意图了,如下所示:

<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="https" android:host="zzz.yyy.com" 
      android:path="/activate*"/> 
     </intent-filter> 

我曾尝试这个代码,并没有在“路径”,并没有结束的通配符(*)迄今的工作。什么不见​​了?

回答

1

android:path是一个文字完整路径。尝试android:pathPrefixandroid:pathPattern - 在这种情况下,pathPrefix似乎就足够了。

+0

完美解决!谢谢! 现在,如果我想要检索整个链接,因为令牌或帐户名称是重要信息,是否有办法抓取已传递到意图的链接? – RyanInBinary 2012-07-27 13:08:31

+0

@RyanInBinary:'getIntent()。getData()'会给你''Uri'与用于启动你的活动的'Intent'相关联。有一个机会,它会离开'''开始的东西 - 我知道你不能过滤查询参数,但我不确定它们是否仍然保留在提供给你的'Uri'。如果它们*被剥离,则需要考虑将URL重写为更多REST-y(例如,“https:// zzz.yyy.com/user/123123123/activate/absdi24”)。 – CommonsWare 2012-07-27 13:29:46

+0

这是正确的。如果它可以帮助其他人,那么使用数据URI中的getQuery返回token = absdi24。 再次感谢您的帮助!希望我可以再次提醒你 – RyanInBinary 2012-07-27 13:40:55

相关问题