1

我想做与 Google+ 应用程序类似的事情,例如,当您在电子邮件应用程序中单击 Google+ 链接时,它会提示您选择浏览器或 Google+ 应用程序。

如何在我的应用程序中实现这样的功能?我尝试过搜索,但很挣扎,因为我认为我没有使用正确的关键字:/

4

2 回答 2

2

干得好:

<action android:name="android.intent.action.VIEW"></action>
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
    <data android:host="YOUR_DOMAIN.com" android:scheme="http"></data>
    <data android:host="www.YOUR_DOMAIN.com" android:scheme="http"></data>
</intent-filter>

只需将 替换YOUR_DOMAIN为您自己的域,它应该可以按预期工作。

于 2013-01-04T14:16:41.827 回答
2

<intent-filer>您可以通过在<activity>应用程序中添加适当的来实现您的目标manifest file

  <activity android:name="">
     <intent-filter>
         <action android:name="android.intent.action.VIEW"></action>
         <category android:name="android.intent.category.DEFAULT"></category>
         <category android:name="android.intent.category.BROWSABLE"></category>
         <data android:host="domain_name" android:scheme="http"></data>
         <data android:host="domain_name" android:scheme="http"></data>
     <intent-filter>
  </activity>

These <activity> is called whenever another app with these <intent-filter> start implicit action with Intent.ACTION_VIEW also adding category and data inside the intent.data and intent.scheme

于 2013-01-04T14:23:04.330 回答