cordova - Android not requesting permission in ionic app -
i building app allows people post pictures , videos, trying learn ionic, cordova, android, , like, reason whenever try open file using cordova file plugin, doesn't ask user permission access storage, , code fails , user stuck on loading screen. code pretty simple, take video, gets transcoded, transcoded file uploaded firebase storage bucket. if quit app, go settings->apps->my app->permissions , manually turn on storage permission, works. problem is, need ask user permission either @ run time or on install, , doesn't. here code..
this.media.capturevideo().then(file => { this.editor.transcodevideo({ fileuri: file[0].fullpath, outputfiletype: this.editor.outputfiletype.mpeg4, outputfilename: 'temp_test', savetolibrary: false, height: 800, width: 800, maintainaspectratio: false }).then(fileuri => { let pathindex = fileuri.lastindexof('/'), finalpath = 'file://' + fileuri.substr(0, pathindex), name = fileuri.substr(pathindex + 1, fileuri.length); this.file.readasarraybuffer(finalpath, name).then(file => { //upload }).catch(err => { console.log(err); }); }); });
however, works if open settings on phone, go apps, app, permissions, enable storage manually. there way request permission in ionic? have searched , searched , answers can find specific camera, or work in java, ionic isn't java. thank you.
Comments
Post a Comment