android SystemProperties屬性的使用

首先需在system.prop中添加

persist.sys.camera_switch=1

之後需要make後纔會在out下面的build.prop中生效,然後重新燒機器,或者調試的時候將build.prop導出來,手動添加,然後再push進去替換,adb shell chmod -R 644 system/build.prop 每次push一次之後,需要運行此命令 否則會開機開不了

然後代碼中調用爲

import android.os.SystemProperties;

SystemProperties.set("persist.sys.camera_switch","1");  字符不能超過31個,否則會報錯
String getState=SystemProperties.get("persist.sys.camera_switch");
發佈了49 篇原創文章 · 獲贊 13 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章