【问题标题】:Starting Android application from browser URI从浏览器 URI 启动 Android 应用程序
【发布时间】:2012-06-20 08:55:06
【问题描述】:
  <activity
                android:name=".RegisterationCompletion"
                android:configChanges="orientation"
                android:label="@string/app_name" >
                <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="test" />
                 </intent-filter>
       </activity>

我需要从浏览器 URI 启动 android 应用程序,但此代码在 Ginger Bread 和其他更高版本中不起作用。有什么想法吗?

【问题讨论】:

  • 它是否在较低版本中工作?
  • test://192.168.254.84:8080/testregisteration/ 我正在提供这样的链接,它在本地托管..
  • 您的代码看起来不错,但不建议创建自定义方案。但是,如果您只是在浏览器中键入此 URL,那将不起作用。网页上的链接应该可以工作。

标签: android html android-browser


【解决方案1】:
  <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.LAUNCHER" />
                <data android:scheme="Testapp" />
     </intent-filter>

重点:我们必须使用href访问链接

注意 AndroidManifest.xml 中的大写和小写字母。

无论您在哪里看到“Testapp”而不是“TestApp”。Android 无法处理除第一个以外的大写字母。

这段代码对我来说很好......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-05
    • 1970-01-01
    • 2013-02-05
    • 1970-01-01
    • 2016-09-11
    • 2023-03-03
    相关资源
    最近更新 更多