Android數據庫安全permission
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(); } |
posted on 2013-11-18 13:42 順其自然EVO 閱讀(264) 評論(0) 編輯 收藏 所屬分類: linux 、android