I found that if I want to use the searchable options using the search key I have to create a content provider. Content provider is used to share data across applications.
But I do not want to allow access to my content provider (as well as my data) except/outside my own application. I want to use it only for search suggestion. Because my app data is kind of restricted.
Is there any way to implement local search without content provider? OR is is possible to apply restriction so that except my own app no other app can use my content provider?
Thanks.
Don’t integrate with the search framework. There is nothing stopping you from having your own separate search mechanism within your app (e.g., an activity that is opened from a Search menu item).
Your app isn’t the one using the content provider — the operating system is the one using the content provider. That’s why trying to apply this sort of security is tricky. C2DM uses some related techniques, and it is possible that the core Android team will apply the same techniques to the search integration in the future, but I wouldn’t hold my breath.
In the interim, either sanitize your search suggestions such that they are safe for publishing through a regular content provider, or implement your own search activity.