How to handle Android power button events? -


i want create android application opened in background when power button pressed twice.

i want know how can handle power button , choose happens when user press power button?

just have in safety apps sends sos messages on number of power key presses.

first need add following permission manifest file:

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

it has 2 methods onkeydown() , onkeylongpress() @override these 2 methods performing actions.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -