views:

21

answers:

1

Hi,

I have the following inside my manifest file:

<service android:name=".Rotate" 
    android:enabled="true"
    android:label="@string/app_name"> 

    <intent-filter>
        <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</service>

However the holding down the search key doesn't activate SEARCH_LONG_PRESS anymore. Before I replaced <activity> with <service> it use to show two options when long pressing the search key, one was my app the other was Google Voice Search... now it's just Google Voice Search.

A: 

That is because SEARCH_LONG_PRESS is not used for services. It is used for activities. Each use of the Intent system (startActivity(), startService(), sendBroadcast()) is independent of the others. You cannot have a service respond to startActivity(), for example.

CommonsWare