In the android we can see that there is a default "google search" on the launcher. And I found out that using setting, we can set the searchable items. For example amazon kindle, music, or browser.
The question is, how can I add my app into the searchable items in the google search? Are there any APIs I can use?
Exactly, the first thing you do is provide a searchable.xml resource to Android. How this is done is described here.
Next, you have to declare an Activity to be searchable in your Manifest, like so:
<activity android:name="...">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable" android:resource="#xml/searchable" />
</activity>
Related
i want to add the MiniMob Ads in my android application. I have read the full documentation from the http://www.minimob.com/integration-guide.html for minimob sdk, but i still dont get it.
Now i have two queries:
We have to give the app url either of the android market or some other when we create new app using the MiniMob sdk. So how can we give that url like 1st upload the app without that minimob integration and get the url of the app and then again upload with the minimob integration.
And the 2nd thing is we have to just give that app id, app key and package name in the manifest and add the jar file in lib. and rest some code which i shown below in that activity where we want to show these Ads. Am i wright ??
<!-- MiniMob Manifest declaration start -->
<activity android:exported="false"
android:name="com.minimob.android.OptinActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="\#android:style/Theme.Translucent" />
<activity
android:taskAffinity=""
android:name="com.minimob.android.PushAds"
android:configChanges="orientation|keyboardHidden"
android:theme="\#android:style/Theme.Translucent.NoTitleBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.minimob.android.DeliveryReceiver"
android:exported="false"/>
<receiver android:name="com.minimob.android.MessageReceiver"
android:exported="false"/>
<receiver android:name="com.minimob.android.BootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<meta-data android:name="MINIMOB_APPID" android:value="id:$appid" />
<meta-data android:name="MINIMOB_APPKEY" android:value="key:$appkey" />
<meta-data android:name="MINIMOB_APPHOST"
android:value="http://mpm.minimob.com/mobile/serve.asp" />
<meta-data
android:name="MINIMOB_ACTION" android:value="com.minimob.android.PushService$appid" />
<service android:name="com.minimob.android.PushService" android:exported="false">
<intent-filter>
<action android:name="com.minimob.android.PushService$appid" />
</intent-filter>
</service>
<!-- MiniMob Manifest declaration end -->
Regarding the app URL, it is there so we can have access to an app for a number of reasons (e.g. troubleshooting). If your app is not publicly available yet you can temporarily enter a random URL and update with the correct URL later when the app has been accepted in Google Play or another app store.
About your second query, please do the things below everytime you want to integrate the Minimob SDK in an app, as it is custom built for each app and instructions will slightly differ.
Go to the Applications page in Minimob and register your app
Click on the "Download SDK" button next to your app
Open the "Instructions.txt" file
The steps are pretty much the ones you have mentioned (copy the .jar file, copy-paste the permissions and declarations in the manifest, add call in your main activity that starts the Minimob SDK).
My searchable activity currently looks like this in the Android Manifest:
<activity
android:name=".activity.Search"
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>
I would like to be able to add my application to the preinstalled "Google Search"-app as a searchable element and therefore accept its search intents.
Seems correct. Did you enable your app in the Google-Search app settings, to be searchable?
I just found this page on the android dev blog. What I've been missing was the xml attribute android:includeInGlobalSearch="true" in my searchable.xml.
I've been following the Searchable Dictionary example pretty carefully as I'm trying to implement the search functionality in my app. Right now I simply can't seem to get the Search interface to open when I press the search button. I've added the following into my manifest and searchable.xml resource into my res folder (which I pretty much copied from the example).
<activity android:name=".main.SearchActivity"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<meta-data android:name="android.app.default_searchable"
android:value=".main.SearchActivity" />
What I'm not understanding is what else do I need to do to get this to work? Is there something I should have hard coded? Thanks a lot!
Nevermind, I realized that in the searchable.xml, you can't use static strings, they have to be from the strings.xml resource. I just had to create search_label and search_hint and refer to them in the searchable.xml file. Here's the original article on that.
i have one activity in my android application in which a list of orders is populated. I want to implement a search functionality on this activity so that user can search for particular order.
I have read about the search box facility provided by adding a searchable.xml file in the application but I am not able to make it work for me?
I just want to add a search box in the activity and search for specific data in database.
How can I do this?
#VNVN I would agree - I would review the developer guide. http://developer.android.com/guide/topics/search/search-dialog.html
You will need to make your activity search-able in the AndroidMainfest.xml file
<activity android:name=".MySearchableActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
</activity>
You are probably missing creating a SearchableActivity. http://developer.android.com/guide/topics/search/search-dialog.html#SearchableActivity
I'm running into an issue with the Quick Search Bar that I'm hoping someone can help me with.
My application includes a Searchable activity used to provide search behavior within my application. That search activity is designed to trigger a separate Intent when the search item is clicked on so as to cause a different Activity to handle the viewing. When used within the application, the search behavior works perfectly every time.
My application also includes a ContentProvider used to provide search suggestions and is also configured to allow use in the Quick Search Bar. When used within the application itself, use of the search suggestions works fine every time it is used. When triggered from the QSB, the initial search suggestion brings up the viewing activity just as it should. After that point, however, any use of the search suggestions from within the application (i.e. bringing up the search and selecting a search suggestion) fails to trigger the viewing application. In fact, I've put debug statements in every single "onXXX()" method within the Searchable activity and I never see any of them get triggered. On the flip side, when I trigger a standard search at that same point (i.e. enter a query string and hit enter, rather than navigating to a search suggestion), the search dialog comes up, as expected, and selecting an item from that list successfully triggers my application.
I'm currently at a loss trying to determine why this would be occurring. Any ideas
As as some additional information, my manifest contains the following in regards to the searchable activity (".activity.SearchableActivity"), the suggestions provider (".content.TestSuggestionProvider") and the activity used to display the content (".activity.TestDisplayActivity"):
<activity
android:name=".activity.TestDisplayActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:finishOnTaskLaunch="true"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.default_searchable" android:value=".activity.SearchableActivity" />
</activity>
<activity
android:name=".activity.SearchableActivity"
android:launchMode="singleTop"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable" android:resource="#xml/searchable"/>
</activity>
<provider
android:name=".content.TestSuggestionProvider"
android:authorities="com.test.provider.suggest"
android:syncable="false"
/>
And the following is the XML used to further define the settings of the searchable activity:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/search_app_label"
android:hint="#string/search_app_hint"
android:searchSettingsDescription="#string/search_app_settings_description"
android:includeInGlobalSearch="true"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:searchSuggestAuthority="com.test.provider.suggest"
android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>
Any thoughts? At the moment I'm at a complete loss…