开发者

android global hotkey

开发者 https://www.devze.com 2023-01-31 06:47 出处:网络
How to start your activity开发者_运维问答 on pressing a global hotkey on android? It is possible, see Button Shortcut app.Here is the solution for the \'search\' button:

How to start your activity开发者_运维问答 on pressing a global hotkey on android? It is possible, see Button Shortcut app.


Here is the solution for the 'search' button:

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


Just for the archive:

This (alone) does not help:

<uses-permission android:name="android.permission.GLOBAL_SEARCH" />

<activity android:name=".VoiceActions"
          android:label="@string/app_name">
          <!-- This must be higher than the default priority (0), which
         is what GoogleSearch uses. -->
    <intent-filter android:priority="500">
        <action android:name="android.search.action.GLOBAL_SEARCH" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>


          <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>

        <meta-data android:name="android.app.default_searchable"
        android:value=".VoiceActions" />
</application>
0

精彩评论

暂无评论...
验证码 换一张
取 消