有没有办法让 Android 清单中的元数据对包保持私有? [英] Is there a way to keep meta-data in the Android manifest private to the package?

查看:23
本文介绍了有没有办法让 Android 清单中的元数据对包保持私有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android 清单中使用元数据来自定义服务的行为.

I want to use meta-data in the Android manifest to customize the behavior of a service.

<service
    android:name=".SampleService"
    android:exported="false">
    <meta-data
        android:name="sampleName"
        android:resource="@string/sampleValue" />
</service>

我的服务是图书馆的一部分,有些人在使用我的服务时可能会将敏感数据放入这些属性中.即使没有导出服务,这些元数据属性是否对手机上其他已安装的包通过 PackageManager 可见?

My service is part of a library, and it is possible some may put sensitive data into these attributes when they use my service. Are these meta-data attributes visible to other installed packages on the phone via the PackageManager even if the service is not exported?

推荐答案

即使没有导出服务,这些元数据属性是否对手机上的其他已安装包可见?

Are these meta-data attributes visible to other installed packages on the phone via the PackageManager even if the service is not exported?

是的.清单中的所有内容以及您的资源和资产中的所有内容都可供设备上的所有应用访问.

Yes. Everything in the manifest, and everything in your resources and assets, is accessible to all applications on the device.

这篇关于有没有办法让 Android 清单中的元数据对包保持私有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆