Tuesday, July 11, 2017

Cordova InAppBrowser and Camera

In Android, inside InAppBrowser will only open file chooser without option of take photo from camera. This has been discussed at HTML File Input should support accept/source attributes

The reason camera option not available is "This issue is low priority because it's an extremely complicated issue to implement and test, and we already have plugins like Camera that work better than this method."


But I didn't get the patch work and I didn't see anyone get it work.

The following ideas/methods have been tried and failed.

1,  Use InAppBrowser executeScript to interact with web page






2,  Use 3rd party plugins


this is an old plugin, the fixes in the plugin already in latest inappbrowser, and the fix doesn't include having camera option in Android


Here's working example outside of InAppBrowser


Unfortunately this only works outside of InAppBrowser. I guess to use this, the default behaviour of trigger 'file chooser' need to be intercepted.








BTW
to customize a plugin, you need modify the plugin file then build again.

ionic cordova build android

same as modify the cordova core src files

No comments: