Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Android "massage viberator" application does not stop vibrating even after the process is killed?

Tags:

android

I will try to be as brief as possible... I have published a very simple android application it's name is "Vib-e-rator PRO". It's purpose is obvious, it can be used as a masssage vibrator or as an erotic stimulator...

My Problem is don't have an Android Phone to test my app in real time.

I have been recieving mixed comments from people. A few users say its working fine. But majority of them complained that the Phone would n quit vibrating even after the closing application.

Later i speculated that when ever the user switched off the vibrator and quit the app it would work as expected. If any user (most of em) directly closed the application ( either through the close option provided in the app itself or by pressing the END button in the phone ) without switching off the vibrator then it would not stop vibrating.

So i added myvib.Cancel() (myvib is the context for Phone Vibrator) in the exit block the close option provided in my app. For the other scenario, when it is closed by pressing the END button in phone, i have no idea how to solve it... So friends please advice me what is necessary to do... The comments i have been receiving from many users of my app is really embarassing....

like image 356
Mithraa Avatar asked Nov 05 '22 07:11

Mithraa


1 Answers

Check out the Activity Lifecycle. I think your best solution is to call myvib.cancel() from inside onPause() or onStop(). Then call myvib.vibrate() from onResume().

like image 133
Felix Avatar answered Nov 09 '22 13:11

Felix