Android 应用程序未安装 intent.action.VIEW

标签 android

当我添加一个 Intent 过滤器(以允许 Google 抓取我的应用程序内容并允许用户从搜索结果中输入我的应用程序)时,我的应用程序仍在我手机上的 Android Studio 中运行,但不再安装。

我的 list 在下面,我已经注释掉了添加的 Intent 过滤器以使其再次安装,所以现在我收到一条警告,它不能被谷歌搜索索引。 我该怎么做才能安装它并且可以编入索引?

这是我的第一个应用程序,如果这很明显,我深表歉意,但我很感激任何帮助。谢谢。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.somename.myappname">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <!--action android:name="android.intent.action.VIEW" /-->
                <action android:name="android.intent.action.MAIN" />

                <!--category android:name="android.intent.category.DEFAULT" /-->
                <!--category android:name="android.intent.category.BROWSABLE" /-->
                <category android:name="android.intent.category.LAUNCHER" />
                <!--data android:scheme="somename"
                    android:host="myappname" /-->
            </intent-filter>
        </activity>

        <activity android:name=".ChildActivity">
        </activity>

    </application>

</manifest>

最佳答案

我似乎找到了解决办法。应该有 2 个独立的 Intent 过滤器 ...

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <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="http"
                android:host="www.mywebsite.com"
                android:pathPrefix="/myappname"  />
        </intent-filter>

关于Android 应用程序未安装 intent.action.VIEW,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46385367/

相关文章:

android - 错误 :(62, 0) 找不到 Gradle DSL 方法: 'compile()'

android - 为什么使用layout_below会弄乱开始按钮的大小?

Android 构建失败并出现 build.xml :479: SDK does not have any Build Tools installed

android - ios 类似 android 平台的日期/时间选择器

java - Gradle 构建 : com. android.library 和 spring-boot 兼容性

android - 使用TabLayout和ViewPager时,应用程序在选项卡2的后退按钮上崩溃

android - 向后兼容性和 Android Open Accessory 库

android - 有没有办法在 Android 中默认 TouchImageView 的比例?

c# - Xamarin 中的大量内存使用

Android Studio 2.2 原生开发迁移问题