Shake Device to Launch App

后端 未结 4 1997
孤独总比滥情好
孤独总比滥情好 2021-01-02 20:52

I am using this to work with Shake, and that works fine for me, but i wanna launch application when user shake their device, see my code below:

 @Override
           


        
4条回答
  •  清歌不尽
    2021-01-02 21:11

    Well What you need is Two different activity Where first One Detects your Shake which need to run all time in background and than call the new actual app you want to run on shake.

    You can run your background activity you have to use class which will keep your activity run in background for long time(Continuously) you can use classes Like FutureTask or Executor (you can not use AsyncTask for this).

    Whenever the thread passes command to Your Application open after Shake the Background process stops and command goes to app means you need to again immediately start background process after the actual app closed.

提交回复
热议问题