gpt4 book ai didi

android - 在 Android 中导出 Activity 是否允许其他应用程序也从该 Activity 调用任何公共(public)方法?

转载 作者:行者123 更新时间:2023-11-30 00:25:39 25 4
gpt4 key购买 nike

在 AndroidManifest 中设置“exported=true”允许其他应用程序启动该特定 Activity 。这是否也允许其他应用程序手动调用该导出 Activity 中的任何公共(public)方法?如果是这样,执行该操作的代码会是什么样子?

最佳答案

请阅读官方documentation小心:

This element sets whether the activity can be launched by components of other applications — true if it can be, and false if not. If false, the activity can be launched only by components of the same application or applications with the same user ID. If you are using intent filters, you should not set this element false. If you do so, and an app tries to call the activity, system throws an ActivityNotFoundException. Instead, you should prevent other apps from calling the activity by not setting intent filters for it.

If you do not have intent filters, the default value for this element is false. If you set the element true, the activity is accessible to any app that knows its exact class name, but does not resolve when the system tries to match an implicit intent.

This attribute is not the only way to limit an activity's exposure to other applications. You can also use a permission to limit the external entities that can invoke the activity (see the permission attribute).

关于android - 在 Android 中导出 Activity 是否允许其他应用程序也从该 Activity 调用任何公共(public)方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45431939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com