Android, Detect when other apps are launched

后端 未结 7 1049
臣服心动
臣服心动 2020-11-22 02:41

I\'m trying to develop an app that prevents a user from getting to a specified app without a password. The scenario is...

  1. user clicks on \"Email\" app (for exa
7条回答
  •  难免孤独
    2020-11-22 03:09

    The main issue is you are trying to listen for implicit intents when the Launcher (home screen) is typically using explicit intents.

    An implicit intent is when you want to say "Somebody play this video" and Android picks an app that can handle that intent.

    An explicit intent is what happens when you click the "Email" icon on the home screen. It is specifically telling Android to open that specific app by fully qualified name (i.e. com.android.mail or something).

    There is no way AFAIK to intercept such explicit intents. It is a security measure built into Android that no two Activities can have the same fully qualified package name. This prevents a third party from cloning the app and masquerading as that app. If what you wish to do was possible, you could theoretically install an app that could block all of your competition's apps from working.

    What you are trying to do goes against the Android security model.

    One thing you could do is partner with specific app developers to forward the intents to your security system, but that's probably not something you want to deal with.

提交回复
热议问题