0

Basically the HTML5 way to access device camera/gallery works fine in most modern mobile browsers. But once wrapped in a MobileFirst/Worklight Android app, this seems to be not working (tested device: Samsung galaxy series).

e.g: The following html file can trigger a behavior of device camera/gallery accessing in a Samsung Galaxy 5 by directly visiting the file URL, but not working when code are wrapped in a MFP Android app.

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="css/main.css">
    <script>window.$ = window.jQuery = WLJQ;</script>
</head>
<body style="display: none;">
<div>
    <input type="file" accept="image/*">
</div>
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
Community
  • 1
  • 1
Sam Su
  • 6,532
  • 8
  • 39
  • 80

1 Answers1

0

This is because you are not really in a browser; you are in a WebView. A Cordova WebView. To access native device features such as camera, campess, filesystem and so own you need to go through the Cordova layer using its supplied API (bundled with Worklight/MFPF). Do that, and you'll be able to access it all...

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • this might be a webview related problem, but in our real device testing, the release app can work on all iOS platform devices and most Android phones except a few weird ones (such as Samsung galaxy5 mentioned above). – Sam Su Nov 25 '15 at 06:15