0

I'm curious if it's possible to create an Application on data partition (This application will be downloaded from Google PlayStore) to 'auto' launch once user has plugged in the device to the power outlet.

I did some digging and notice that we can listen to this broadcast:

<receiver android:name=".broadcastReceiver">
  <intent-filter>
     <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
     <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
  </intent-filter>
</receiver>

Is it possible to listen to this broadcast and get launched once user has plugged in the device to a power outlet?
Will Google let us do this?

I am trying to target API 29 on Android 10.

Zoe
  • 27,060
  • 21
  • 118
  • 148
lynx
  • 45
  • 1
  • 7
  • https://stackoverflow.com/questions/55705364/run-code-background-when-charger-gets-connected/55705598 The answer you are looking for is here – Narendra_Nath Apr 27 '21 at 06:50
  • Ah thanks but reading that post it says : "It seems like you can't listen to these kinds of broadcasts anymore if you're running API level 26+" Is this true? Also noticed this post: https://stackoverflow.com/a/45459483/2855319 but this was dated 5yrs ago. Will this still hold for API 29? – lynx Apr 27 '21 at 19:52

0 Answers0