How to disconnect an Android phone?

I want to do something when the user disconnects the Android phone. How can an application determine it programmatically?

+2
source share
3 answers

http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN `

<receiver android:name=".ShutdownReceiver">
    <intent-filter>
        <action android:name="android.intent.action.ACTION_SHUTDOWN" />
        <action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
    </intent-filter>
</receiver>
+5
source

This is something that can give you an idea of ​​the OS you are working on, and not about developing an application that will work on any device, since you did not make an OS for them.

android, , , , . , .

, .

:

<receiver android:name=".ShutdownReceiver"> 
<intent-filter> 
    <action android:name="android.intent.action.ACTION_SHUTDOWN" /> 
    <action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
</intent-filter> </receiver>

Action SHUT DOWN.

http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN

+1

Source: https://habr.com/ru/post/1607952/


All Articles