PouchDb.get(id,{attachments: true}) not returning data on Android

廉价感情. 提交于 2019-12-12 13:33:15

问题


I am developing an Ionic App using PouchDb (No replication). I am able to store data with attachments successfully.

To retrieve the data, I use the controller snippet below to call the get function in an angularjs factory,

pouchDbManager.getData(currentSongIdx).then(function(result) {
        $scope.songs.push({title:result.title,image:result.image}); 
       audioFile=$sce.trustAsUrl("data:audio/mp3;base64,"+result._attachments.song.data);
        $scope.playCurrentSong(audioFile); 
        if(result.sermon_favourite == 1) {$scope.favourited = 1}
    }); 

The factory snippet is below

.factory('pouchDbManager', function($q) {
   ......
   function getData(id){
        return $q.when(_db.get(id,{attachments: true}));
    }
   ......
  }

The snippets above work perfectly in my chrome browser returning data and the expected attachment. But when I build the project and run it on my android device, no data is returned.

With a bit of console logging, I discovered the getData function in the factory wasn't returning data.

I also used pouchdb.get(id) and pouchdb.getAttachment(id, filename).

While both functions also worked optimally on Chrome, pouchdb.getAttachment failed to return expected attachment on my android device.

The attachment is stored in base64 and its about 10-15mb

Has anybody experienced this issue? Kindly help out

I am developing with Ionic, AngularJs, Pouchdb 5.3.1, Cordova, Android 4.4.2 with 2GB Ram.

来源:https://stackoverflow.com/questions/36603438/pouchdb-getid-attachments-true-not-returning-data-on-android

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