【问题标题】:MFP seems to disable the ability of accessing the device camera/gallery in some Android devicesMFP 似乎禁用了在某些 Android 设备中访问设备相机/图库的功能
【发布时间】:2015-11-25 03:46:29
【问题描述】:

基本上HTML5 way to access device camera/gallery 在大多数现代移动浏览器中都能正常工作。但是一旦包裹在 MobileFirst/Worklight Android 应用程序中,这似乎无法正常工作(测试设备:三星 Galaxy 系列)。

例如:以下 html 文件可以通过直接访问文件 URL 来触发在三星 Galaxy 5 中访问设备相机/图库的行为,但当代码封装在 MFP Android 应用程序中时不起作用。

<!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>

【问题讨论】:

    标签: android html ibm-mobilefirst


    【解决方案1】:

    这是因为您并没有真正在浏览器中;你在一个 WebView 中。 Cordova WebView。要访问本机设备功能,例如相机、campess、文件系统等,您需要使用其提供的 API(与 Worklight/MFPF 捆绑)通过 Cordova 层。这样做,您将能够访问所有内容...

    【讨论】:

    • 这可能是webview相关的问题,但是在我们的真实设备测试中,发布的app可以在所有iOS平台设备和大多数Android手机上运行,​​除了一些奇怪的手机(比如上面提到的三星galaxy5) .
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-04
    • 2013-02-16
    相关资源
    最近更新 更多