Skip to main content

Posts

Showing posts from February, 2017

ionic2 - cordova camera plugin content:// in img tag , image not displayed

Recently in ionic2 I faced a weird problem when using camera plugin  in android  . My app simply allows user to either take picture from camera or select image from gallery. When user takes picture from camera everything works fine but if user selects image from gallery , image is not displayed (using img tag). Very first difference i spotted between camera and gallery image was the uri of file. Camera image has following format file:///path/to/image.jpg where gallery image has following format content://media/external/image/238 I debugged my project using Android Studio and I found that when i try to display gallery image using img tag , following error is shown in console URL blocked by whitelist  It was clear that whitelist plugin is blocking content:// requests so I tried to add content:// as whitelisted uri in my config.xml . I added the following lines <access origin="content://*" /> <allow-nagivation href="content://*" /> BUT TO NO

Ionic2 - Blank white screen for long time before showing root page

I recently upgraded to ionic2 from ionic1. Ionic2 is better than ionic1 in so many ways but one problem that I started facing in my apps built for android was annoying the hell out of my clients. Problem was, that before showing the first screen of app (a.k.a root page) there was a blank white screen for approx 10-12 (and sometimes 15) seconds. First I thought it may be because of many plugins installed but problem was there even in a newly created project based on blank template. How I was building my apk was very simple cordova build --release android After completing all the steps listed here I deploy my apk to device. But after little reading on internet about this white screen issue I found that command to generate production ready build is as follows ionic build android --release --prod This solved my white screen problem and now my Root page appears just after 1-2 secs of launching my app.