我有一个应用程序,它有两个都扩展的搜索建议提供程序 SearchRecentSuggestionsProvider, ,并且我已经在清单文件中正确设置了它,其中包含以下内容 Intent 过滤器和元数据:

<intent-filter>
   <action android:name="android.intent.action.SEARCH" />
</intent-filter>

<meta-data
   android:name="android.app.searchable"
   android:resource="@xml/searchable_tv" />

可搜索资源包括 android:includeInGlobalSearch="true", ,所以那应该没问题。

很明显,我也有一个供应商:

<provider
   android:name="com.miz.contentprovider.TvShowContentProvider"
   android:authorities="com.miz.contentprovider.TvShowContentProvider"
   android:exported="true" />

这一切在Android4.3中使用Google搜索应用程序工作得很好,但我刚刚将所有设备更新到Android4.4,我不再能够在我的应用程序中搜索内容。同样的事情也适用于在操作系统更新之前工作的其他应用程序,即谷歌播放音乐。

我在XDA开发人员上找到了一个线程,如果有帮助的话,它也提到了这一点: http://forum.xda-developers.com/showthread.php?p=47472102

有没有人知道发生了什么或如何修复?

更新资料:我可以确认它只发生在Android4.4的设备上。我已经使用最新的Google搜索更新在Android4.3设备上进行了测试,并且按预期工作。看起来这是Google更新中的一个错误。

有帮助吗?

解决方案

我在AOSP中发现了这个提交,这可能是相关的:https://android.googlesource.com/platform/packages/apps/QuickSearchBox/+/ecf356c15143ab0583c64682de16d94a57f7dd1c

提交消息告诉我们,由于性能原因,这个特性被删除了(这可能是真的,也可能不是真的,因为它引用了一个内部票证id,而我在官方的bugtracker上没有找到相关的问题)。

其他提示

我检查了谷歌的联系人, 应用程序索引 正在取代这个。文档将被更新以显示此为已弃用,并且没有办法在没有系统级别权限的情况下使此功能在Kit Kat上工作(如上面的iDev所示)。

自上次更新(v31)以来,Google Chrome现在作为可搜索的应用程序出现。

系统应用:

有这样的尝试

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.globalsearch" android:sharedUserId="android.uid.shared">
    <uses-permission android:name="android.permission.GLOBAL_SEARCH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
    <application android:label="@string/global_search" android:process="android.process.acore">
        <activity android:name=".GlobalSearch" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" android:stateNotNeeded="true" android:theme="@android:style/Theme.NoDisplay" android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- This must be higher than the default priority (0), which
is what GoogleSearch uses. -->
            <intent-filter android:priority="500">
                <action android:name="android.search.action.GLOBAL_SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
        </activity>
        <activity android:name=".SearchSettings" android:label="@string/search_settings">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.search.action.SEARCH_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <provider android:name=".SuggestionProvider" android:authorities="com.android.globalsearch.SuggestionProvider" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" />
        <provider android:name=".StatsProvider" android:authorities="com.android.globalsearch.stats" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" />
        <meta-data android:name="android.app.default_searchable" android:value=".GlobalSearch" />
    </application>
</manifest>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top