I wrote a new Content Provider to serve a new Searchable Item class for the Search Manager.
As I understand now, user has to opt-in so that my new searchable item class is included in their global search.
Is there a way to automatically opt-in when my app is installed? Or to do this programmatically so that I can provide a dialog box where user can opt-in through my app easily?
No.
No. However, you can try to invoke
ACTION_SEARCH_SETTINGS
to start up the search page of the Settings app, where the user can check the checkbox.