I am creating an Android application that I want to auto-start as soon as the mobile is plugged into charging or headphone is plugged into it. Please provide any solution as to how to do it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To detect charging state, use BroadcastReceiver and register in your manifest file like ::
and to detect headphone is plugged or not use
AudioManager.isWiredHeadsetOn()