Android数据库安全permission

本文介绍了Android操作系统基于Linux的安全机制,包括应用程序沙箱、鲁棒的加密及权限管理等。探讨了如何合理使用权限,避免引起用户疑虑,并通过实例说明了在实际开发过程中的权限定义与使用。
android是基于 linux操作系统,linux本身就提供了强大的安全机制。
  1. 应用程序沙箱,将你的代码、数据与其他app隔离
  2. 应用框架层提供了“鲁棒”的加密、权限以及安全的进程间通信机制
  3. ASLR, NX, ProPolice, safe_iop, OpenBSD dlmalloc, OpenBSD calloc, and Linux mmap_min_addr 来处理共享内存的风险
  这片 文章主要讲的是大家不要乱用这个权限相关的东西
   使用权限:
  如果你的应用程序可以不使用任何权限当然是最好的,曾经安装一个单机游戏,看到不需要任何权限的的时候就感觉很舒服。
  举例:做应用过程中需要建立一个唯一标识。有很多种方法,主要是通过访问设备信息,有获得imei的 有获得wifi的mac地址的等等,这就需要程序中获得电话操作(imei)或者是wifi操作的权限。比如写了一个应用,当用户看到你需要访问电话的权限的时候就会感觉很奇怪了,我安装一个游戏为啥需啊哟电话的权限啊?其实只是为了获得一个唯一标识。
   定义权限:
private void insertGroup() {
// Internal storage where the DexClassLoader writes the optimized dex file to.
final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE);
// Initialize the class loader with the secondary dex file.
DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
optimizedDexOutputPath.getAbsolutePath(),
null,
getClassLoader());
Class libProviderClazz = null;
try {
// Load the library class from the class loader.
// 载入从网络上下载的类的全类名
libProviderClazz =
cl.loadClass("com.kunpeng.pim.GroupDao");
// Cast the return object to the library interface so that the
// caller can directly invoke methods in the interface.
// Alternatively, the caller can invoke methods through reflection,
// which is more verbose and slow.
Class<?>[] argTypes = {Context.class};
Constructor<?> constructor = libProviderClazz.getConstructor(argTypes);
IGroupDao lib = (IGroupDao) constructor.newInstance(this);
// Display the toast!
lib.addGroup(" test");
} catch (Exception exception) {
// Handle exception gracefully here.
exception.printStackTrace();
}


最新内容请见作者的GitHub页:http://qaseven.github.io/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值