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?
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" />