2

I've changed applicationId and after that search functionality in my application stopped working. I initiate search via:

activity.onSearchRequested();

Essential part of AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.androzic" >

    <application
        android:name=".Androzic"
        android:icon="@drawable/icon"
        android:label="@string/app_name" >

        <activity
            android:name=".SearchableActivity"
            android:exported="true"
            android:label="@string/search_name"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>

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

Essential part of build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.androzic.v2"
        minSdkVersion 8
        targetSdkVersion 21
    }
}

How do I properly configure search if my applicationId is not the same as package id?

Andrey Novikov
  • 5,563
  • 5
  • 30
  • 51

2 Answers2

0

Write this before </application>

<meta-data
android:name="android.app.default_searchable"
android:value=".SearchableActivity" />
Hardik Chauhan
  • 2,750
  • 15
  • 30
0

If you specified applicationId with other value than package attribute, it's safe to set full qualified class name as android:value of meta-data element, like below.

<activity
        android:name="com.androzic.SearchableActivity"
        .../>

or

<meta-data
    android:name="android.app.default_searchable"
    android:value="com.androzic.SearchableActivity" />
Joo Young Jung
  • 116
  • 1
  • 5
  • I will not verify this solution as the question is outdated but it looks like this is what I was searching for. So I will accept this as an answer. – Andrey Novikov Mar 07 '17 at 11:41