简体   繁体   English

Android、Cordova/PhoneGap、Cordova-Plugin-File 上的 SMS/MMS 数据位置

[英]SMS/MMS data location on Android, Cordova/PhoneGap, Cordova-Plugin-File

I'm creating a Cordova app and I'm using their file plugin to access files within the system.我正在创建一个 Cordova 应用程序,并且我正在使用他们的文件插件来访问系统内的文件。 the problem is, it doesn't seem to recognize the file.问题是,它似乎无法识别该文件。

One thing I know is different android versions have different locations for messages, according to source , my emulator which that runs Android version 13 should have the messages located here: /data/user_de/0/com.android.providers.telephony/databases/mmssms.db . One thing I know is different android versions have different locations for messages, according to source , my emulator which that runs Android version 13 should have the messages located here: /data/user_de/0/com.android.providers.telephony/databases/ mmssms.db According to source1 /data is one of the root folders on the android system.根据source1 /data是 android 系统上的根文件夹之一。

Assume this code is within on device ready:假设此代码在设备就绪内:

    function success(fileEntry)
    {
        fileEntry.file(function(file) {
            var reader = new FileReader();
            reader.onloadend = function(e) {
                var content = this.result;
                alert(content);
        };
            reader.readAsText(file);
        });
    }

    function fail(e)
    {
        alert('failed to locate file: ',e);
    }
    window.resolveLocalFileSystemURL('/data/user_de/0/com.android.providers.telephony/databases/mmssms.db',success, fail);

When emulating, it runs the fail callback function.仿真时,它运行失败回调 function。

So my question is, what am I doing wrong?所以我的问题是,我做错了什么? I'm not well read on Cordova and the help would be greatly appreciated!我对 Cordova 的阅读不是很好,我们将不胜感激!

It's because you can't have access to that directory.这是因为您无法访问该目录。 Read the documentation to know which folders you have access to and resolve the path. 阅读文档以了解您可以访问哪些文件夹并解析路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM