2014-03-12 136 views
0

我有两个应用程序,AppOne和AppTwo。从网页启动Android应用程序

AppOne是一个简单的应用程序,它出口的活动,以便它可以从网页上推出了具有以下意向筛选

<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="what should be the host for a local page?" 
       android:scheme="what should be the scheme?" /> 
</intent-filter> 

AppTwo包含具有web视图的活动。在WebView中,我加载本地HTML页面,用的index.html以下HREF

<A href="intent://[what should be this URI]">launch app</A> 

具体来说,我想知道

  1. 应该是什么本地加载页面的主机名?
  2. 该方案应该按照哪种方案进行?

感谢

回答

0

该方案可以是你希望它是什么 - 所以选择一个词,这意味着什么,以你的应用程序,如“apptwo”。

如果您的方案是唯一的,那么您不需要在意图过滤器的数据部分指定主机。如果你只是使用链接作为触发器(即你总是加载相同的页面index.htm),那么URL的其余部分是什么并不重要。

在AppTwo中,您只需安排在意图触发时将相关文件加载到webview中。

 
    <a href="apptwo://trigger">launch app</a> 
+0

感谢您的回复。我从某个地方读到,使用自己的方案并不是一个好主意。 – iuq

相关问题