qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          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();
          }

          posted on 2013-11-18 13:42 順其自然EVO 閱讀(264) 評論(0)  編輯  收藏 所屬分類: linuxandroid

          <2013年11月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 海丰县| 霍州市| 眉山市| 清河县| 株洲市| 喀喇| 靖州| 大港区| 义马市| 上林县| 尖扎县| 西吉县| 木里| 多伦县| 阿瓦提县| 河北区| 南和县| 深水埗区| 昌吉市| 瓦房店市| 桃园市| 聂拉木县| 阿坝县| 康平县| 天津市| 晋州市| 西林县| 崇文区| 寿光市| 会宁县| 灵川县| 正宁县| 庐江县| 什邡市| 武山县| 和顺县| 呼玛县| 鸡东县| 贵溪市| 定南县| 拜泉县|