向 activity 添加权限以在 android 应用程序中提供安全性(避免 activity 绕过 android)

adding permissions to activity to provide security in android app (avoiding activity bypass in android)

我知道如何为应用程序添加权限,如互联网权限和读写外部目录权限

但我想问的是如何为每个 activity 添加权限以避免绕过活动。

我们如何在 android 应用程序中提供安全性。

i'm asking how to add permissions for each activity in order to avoid bypassing of activities

Android 权限系统中没有任何内容与 "avoid bypassing of activities" 有关。

因此,我将把你的问题和 follow-up 对你问题的评论解释为:

I have seen where some apps allow users to bypass certain activities in other apps, effectively "deep linking" into them. In my case, this will skip past an authentication activity that I want to show. How can I stop this?

third-party 应用可以将用户发送到的唯一活动是在您的应用中导出的活动。一个 activity 被导出,如果:

  • 您的 <activity> 元素上有 android:exported="true",这是不寻常的,或者

  • 你在<activity>上有一个<intent-filter>,比较常见

在您特别想要 third-party 应用到 link 的活动中只有 <intent-filter> 个元素。从任何其他活动中删除任何 <intent-filter> 元素。这将阻止 "bypassing of activities",但您希望直接从外部访问的那些活动除外。