Search code examples
androidcallbackhybrid-mobile-app

Notify webapp that the image has been successfully captured from android hybrid app


I have below query:

Scenario We have developed an android hybrid application, where our web application hosted on remote server is opened inside the webview container of Android.

Requirement To capture image from camera and attach with the form.

Limitations Android cannot call methods (callback) on remote javascript. The web application, being a single page HTML5 and jQuery application, cannot be reloaded/navigated.

Present Implementation We are able to open camera by capturing the url navigation event of android webview (navigation triggered on ‘attach’ button click to a dummy url for website). But still no way to notify the webApp that the image has been successfully captured/uploaded on server. Any help is greatly appreciated.


Solution

  • One way is to poll server at regular intervals and check. Since u cannot call remote js.

    Other option not preferred, is to reload webview(refresh current page in browser history) once u are done with image uploading in background from native.