blubsy Posted September 8, 2011 Share Posted September 8, 2011 Bonjour, je cherche à déceler dés que le device est branché à une prise (usb -> ordi/murale/allume cigare). Peut importe lesquels j'ai juste besoin de mettre en pause mon application lorsque le device est en charge. Merci par avance pour votre aide. Link to comment Share on other sites More sharing options...
TecKnologikS Posted September 8, 2011 Share Posted September 8, 2011 J'ai pas le temps de te donner la fonction exacte mais dans android.sytem si je me souviens bien on peut faire une demande si il charge ou pas. un ptit if (tel = charging) avec tel qui pointe sur: et le tour est jouer... je précise ce soir si quelqu'un ne l'a pas fait (j aurai plus de temps :P ) public static final String ACTION_POWER_CONNECTED Since: API Level 4 Broadcast Action: External power has been connected to the device. This is intended for applications that wish to register specifically to this notification. Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to stay active to receive this notification. This action can be used to implement actions that wait until power is available to trigger.This is a protected intent that can only be sent by the system.Constant Value: "android.intent.action.ACTION_POWER_CONNECTED" Link to comment Share on other sites More sharing options...
Lord Yu Posted September 9, 2011 Share Posted September 9, 2011 Pour intercepter l'évènement regarde du côté de public static final String ACTION_BATTERY_CHANGED Plus d'info ici. Link to comment Share on other sites More sharing options...
TecKnologikS Posted September 10, 2011 Share Posted September 10, 2011 merci d'avoir fini ma reponse =D Link to comment Share on other sites More sharing options...
blubsy Posted September 10, 2011 Author Share Posted September 10, 2011 Genial merci beaucoup pour votre aide. Plus qu'a bosser et à mettre tous ça en place dans mon appli. Bonne fin de weekend à tous et merci à tous ceux qui prenne 2 sec à répondre à toutes nos questions. @+ blubsy Link to comment Share on other sites More sharing options...
TecKnologikS Posted September 11, 2011 Share Posted September 11, 2011 bah perso j'essaye de repondre a ce que je peut sachant que je suis pas super fort mais ca me desole de voir si peu de confirmer répondre au question ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.