I want my app automatically open when user click (for example) chrome or any other apps. How to do this? My app is for preventing people use cell phone all the time. Explicitly, there is a mission in my app. when user starts this mission, user cannot use other app until they give up the mission. User can minimize my app, but when user click another app, my app will prompt programmatically to tell user not to use the cell phone.
Asked
Active
Viewed 1,717 times
1
-
you need a service for that and probably root access. – Mike Clark Mar 03 '15 at 04:49
-
use `implicit intent` check here http://developer.android.com/guide/components/intents-filters.html – Rustam Mar 03 '15 at 04:50
-
Why would you want to do this? I can think of plenty of ill-meaning reasons for this (not that yours would, necessarily) but it would at least point you as to why there are safeguards against what you might be trying – cchapman Mar 03 '15 at 04:53
-
1@cchapman900 As a programmer, please open your mind. I am doing a positive app which has its purpose as preventing people use their cellphone all the time. Not anything like you said, please take back your word. – Kevin Science Mar 03 '15 at 05:32
-
you may refer this http://stackoverflow.com/questions/1609573/intercepting-links-from-the-browser-to-open-my-android-app – zeisuke Mar 03 '15 at 05:42
-
1As I mentioned, I don't imply that you will use this maliciously, but it will at least explain as to why there are procedures in place to prevent doing what you are requesting. – cchapman Mar 03 '15 at 05:57
-
@Rustam Thank you for your answer, could you tell me more detail about implicit intent? I read the link and other tutorial about implicit intent, which can open another app triggered by my app. – Kevin Science Mar 03 '15 at 06:20
-
I agree with Mike Clark, you would need root access and a service. – Kevin Crain Mar 03 '15 at 06:43
1 Answers
0
Instead of preventing user to launch other apps, I think you should use activities' life cycle.
You can add code in onPause()
and detect user press home button or back button. And when your activity is not on foreground, you can pop a dialog or something to remind your user focus on his work not his phone.
BTW I do see the positive side of your app.

Bob
- 34
- 5
-
@KevinScience And I do not thinking implicit intent is suitable in this case. Implicit intent will let you start your activity or service remotely. Activity's name or class is not required. But you need to register a intent. In your case, you may need modify ALL APPs on the phone to launch a intent before display their own activities. – Bob Mar 04 '15 at 16:13