0

I want to bring my application to front if the cell phone has a speed more than 70 km /hour. It already runs in background as a service. Any help will be highly appreciated.

Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121

1 Answers1

2

You can follow the above steps:

  1. In the service you will have to detect the speed of the phone using accelerometer. See Using accelerometer to calculate speeds and there are many other questions to answer this part.

  2. When you detect the speed going above 70 km/hr, open the home activity of the app using Intent. See android start activity from service

You may have to include a check that if the activity has been started once, when the speed went over 70km/hr, it should be started again and again for the same ocassion.

This is my 2 cents for your problem. Hope it helps.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124