我有一個路由設備,當我做到這一點無法讀取內部存儲的文件(文件不存在問題)
adb shell cat /data/misc/bluetooth/dynamic_auto_pairing.conf
它打印這個文件的內容。
但在我的代碼中,當我寫這樣的東西時,它說文件不存在。那麼從控制檯我看到它我知道在那裏,但從代碼我無法讀取它。我的問題是什麼問題,我是否缺少一些許可或者什麼問題?有人可以給我提供一些代碼來閱讀這個文件中的內容。
感謝
File pa = new File("/data/misc/bluetooth/","dynamic_auto_pairing.conf");
//this doesn't works also
//File pa = new File("/data/misc/bluetooth","dynamic_auto_pairing.conf");
//File pa = new File("/data/misc/bluetooth/dynamic_auto_pairing.conf");
if(pa.exists()){
Log.v("tag", "does exists");
}else{
Log.v("tag", "does NOT exist");
}
ü沒有添加以下權限到您的應用程序: <使用許可權的android:NAME = 「android.permission.BLUETOOTH」/> <使用許可權的android:名稱= 「android.permission。BLUETOOTH_ADMIN「/> –
我不試圖訪問藍牙,我只是想從內存中讀取文件 – Lukap