Public path of Android Q

问题: I have tried to write the file into "/mnt/sdcard" path its return error. Code on JNI layer(C++) using normal fopen("new.txt","w") And also tried the same with "/mnt/sdcar...

问题:

I have tried to write the file into "/mnt/sdcard" path its return error. Code on JNI layer(C++) using normal fopen("new.txt","w")

And also tried the same with "/mnt/sdcard/Android/data/" even failed.

Device: Android Q Beta4

fopen("/mnt/sdcard/new.txt","w") fopen("/mnt/sdcard/Android/data/new.txt","w")

We already Refer the storage restriction in Android Developer page for Android Q.

Which path used for store the public information?


回答1:

Apps cannot store data in arbitrary locations on external or removable storage in Android Q (by default) or Android R (for all apps). The fact that you happen to be using the NDK does not change this.

Your Java code should pass down a valid filesystem path for your NDK code to use (e.g., getExternalFilesDir() on Context).

  • 发表于 2019-07-05 17:55
  • 阅读 ( 251 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除