-3

I am new to android. I am currently looking for developing a android application which quickly needs to enable my application. It may be pressing a power button or volume button in a specific pattern or taping the screen continuously. I doesn't want to use the screen light on or off since it activates my application for some random reason.

Prasath Rao
  • 59
  • 1
  • 4

1 Answers1

0

Android does not have a built in feature that lets you run an application by pressing the hardware keys.

A possible solution would be to run a service that intercept the volume keys (https://stackoverflow.com/a/7130685/2804473). This solution will probably be too intrusive for the end user though.

I would not recommend your proposed idea. Instead, play by the given "rules" that the Android environment provides. You might want to use a Widget instead? If the hardware-trigger is that important, maybe you should take a look at accessories such as Pressy (https://play.google.com/store/apps/details?id=com.pressy.app) or similar?

Community
  • 1
  • 1
  • Hi Simon, Thanks for the reply. Yes, I need to perform specifically on hardware- trigger since I have no time to unlock my screen or do something else. – Prasath Rao Dec 20 '14 at 14:21
  • Take a look at the last part of my answer. You could use the microphone button to trigger events, and that won't be that intrusive to normal usage. Good luck! :-) – Simon Cedergren Malmqvist Dec 20 '14 at 14:45