我正在尝试使用Web API在Android 6.0.0上启动相机。下面是在Web浏览器上完美运行的代码片段。
print ("Welcome to My Pizzeria!")
name = input("What name is the order under? ")
total = 0
while 1:
size = input("What size would you like? ").lower()
if size == 'large':
total += 10.00
break
elif size == 'medium':
total += 7.00
break
elif size == 'small':
total += 5.00
break
else:
print("Sorry, that is not an option! Please order something else!")
while 1:
top = input("Would you like to add sausage? ").lower
if top == 'no':
total += 0.00
break
elif top == 'yes':
total += 1.00
break
else:
print("Sorry, that is not an option! Please order something else!")
print ("Your total is $" + str(total))
print ("Thank you for your order " + name + "!")
我已将这段代码捆绑到带有离子框架的apk中。但在手机上,它会显示损坏的视频播放图像。
在进一步调试时,我注意到“权限被拒绝”错误被抛出。我不确定这个错误被抛出的原因。我用Google搜索并完成了提供的所有解决方案。但它对我没用。
如果我尝试通过phoneGap构建它,它会显示NavigatorUserMediaError {name:“PermissionDeniedError”,消息:“只允许安全来源(请参阅:某些URL)。”,constraintName:“”}
你能帮我吗?
答案 0 :(得分:0)
请尝试这个答案。
http://api.phonegap.com/1.0/camera
使用示例
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
versionCode = "10"
version = "1.0.0" >
<!-- versionCode is optional and Android only -->
<name>PhoneGap Example</name>
<description>
An example for phonegap build docs.
</description>
<author href="https://build.phonegap.com" email="support@phonegap.com">
Hardeep Shoker
</author>
<!--
If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
permission on your app, which PhoneGap requires.
-->
<preference name="permissions" value="none"/>
<!-- to enable individual permissions use the following examples -->
<feature name="http://api.phonegap.com/1.0/battery"/>
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
</widget>
答案 1 :(得分:0)
也许您的Android运行时权限存在问题。 Here你可以在Ionic的讨论中看到这个问题的答案。此问题以不明显的方式发生,但所有问题都存在于Android 6 Runtime Permissions system中。您可以adding the permissions to your manifest和requesting the runtime permissions解决问题。