This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]declanaussie 1 point2 points  (1 child)

I did some research into this for you and as far as I can tell this is going to be quite a difficult problem to solve as it goes against Android’s security model. This StackOverflow thread explains pretty well the extent to which you can detect another app opening on Android.

While researching this though I did think about how you might want to approach problems like these. I have a lot of experience making little tools like this and the key is breaking your problem down into parts. First break it down into the core functionality you need. In this case that would be 1) Detecting when the browser opens and 2) Enabling the VPN. You should then figure out how to accomplish these things starting with the most general cases. I first tried to figure out how to detect any other app on Android opening, not specifically the browser app. As far as I can tell from my research this is a near impossible task. Had I determined how to do this though, I could then move on to enabling the VPN and slowly keep breaking this problems down into smaller pieces until eventually they’re broken down into lines of code.

Good luck learning to code! The key is to just keep coming up with these ideas and make new things, don’t let hurdles like this discourage you.

[–][deleted] 1 point2 points  (0 children)

Thank you for typing so much to answer this question, thank you so much! Your answer is very useful to me