local file access on Google-Chrome-ARC?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 19:39:39

Yes, application on ARC is sandboxed and unable to access to local file system.

However, you can access to the file on your local file system by starting Activity with specific Intent: ACTION_GET_CONTENT for reading file and ACTION_SEND for saving file.

e.g. If you would like to open image file from your local file system,

private static int REQUEST_CODE = 5;

private void requestImageFile() {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    startActivityForResult(intent, REQUEST_CODE);
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE) {
        ImageView imgView = new ImageView(this);
        imgView.setImageURI(data.getData());
        setContentView(imgView);
    }
}

ARC app may have access to OS Filesystem (via browser file chooser), but will not be able to modify them, i.e. ARC will first copy these items to a different location and feed the app with the copy instead of the original file.

Further read :

https://sslab.gtisc.gatech.edu/2014/arc-security.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!