Android数据库安全permission

简介:
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/

相关文章
|
2月前
|
网络协议 关系型数据库 MySQL
如何实现无公网ip远程访问本地安卓Termux部署的MySQL数据库【内网穿透】
如何实现无公网ip远程访问本地安卓Termux部署的MySQL数据库【内网穿透】
|
4月前
|
存储 数据库连接 数据库
Android数据存储:解释SQLite数据库在Android中的使用。
Android数据存储:解释SQLite数据库在Android中的使用。
43 0
|
7月前
|
数据库连接 数据库 Android开发
Android -- Room简化数据库设置图书案例
Android -- Room简化数据库设置图书案例
23 0
|
1月前
|
Android开发
Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
31 3
|
5天前
|
Android开发
Permission Denial: not allowed to send broadcast in android
Permission Denial: not allowed to send broadcast in android
8 0
|
2月前
|
存储 SQL 数据库
【Android 从入门到出门】第六章:使用Room数据库并测试
【Android 从入门到出门】第六章:使用Room数据库并测试
34 4
|
2月前
|
网络协议 关系型数据库 MySQL
安卓手机termux上安装MariaDB数据库并实现公网环境下的远程连接
安卓手机termux上安装MariaDB数据库并实现公网环境下的远程连接
|
3月前
|
数据库 Android开发 数据库管理
【Android】使用android studio查看内置数据库信息
【Android】使用android studio查看内置数据库信息
91 0
|
9月前
|
API 数据库 Android开发
Android 中SQLite数据库的使用详解
Android 中SQLite数据库的使用详解
64 0
|
9月前
|
数据库 Android开发 数据库管理
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
53 0