Is it ok to use browser/webview js API to access camera/geolocation after we push the app to appstore?

We have been using ionic app as a mobile website so far and now we wish to hit the appstore. We have been using browser level javascript apis to access geolocation of users and ‘take a picture’ ability to capture & upload pics.

Question: Is it really important to use cordova apis to access such things on native and not rely on browser/webview level javascript apis once we push to native? I tested the current app in Ionicview and it seems to work fine without using cordova.

yep… if you want to upload files to your backend you need the cordova-file-transfer-plugin to do that. Even the geolocation handling is different --> If you not add the plugin the appstore/user does not know that the app requires your current location and this is forbidden!

The user needs to accept the necessary permissions.

So is it sufficient if I include the library and required permissions but not use cordova apis? Would there be any issue working with webview js apis in native shell?

Have you had an answer to this from elsewhere? I am also interested and wonder if the approach you suggested will work.


It was all working well for me until I started preparing my app for android. Turned out that browser’s js apis had some issues on android webview. For instance, tapping on a file input didn’t show “capture using camera”. Its not widely supported across all its versions. Check this thread for more information

So I had to start using cordova api to get the job done.

I also faced some issues with geolocation on android. Worked well when I started using cordova’s geolocation.

It was easy and I would say worth the effort. Now I at least don’t have to worry about functionality of my app across different versions.

You can integrate this while also supporting your app hosted as a website. Use conditional blocks in your template using ionic platform utility module.

Hope this helps.

1 Like