Ca-Xamarin Forms从PCL请求互联网许可Android 6

Ca-Xamarin Forms从PCL请求互联网许可Android 6,第1张

概述我正在使用Xamarin.Forms构建跨平台应用程序.对于内容,我使用异步调用返回JSON的API.因此,我需要INTERNET权限.与API联系的代码示例:vardata=awaitwc.GetStringAsync("http://website.for.content/content-api/Category/?format=json");此行在Android清单中:<uses-perm

我正在使用Xamarin.Forms构建跨平台应用程序.
对于内容,我使用异步调用返回JSON的API.
因此,我需要INTERNET权限.

与API联系的代码示例:

var data = await wc.GetStringAsync("http://website.for.content/content-API/category/?format=Json");

此行在AndroID清单中:

  <uses-permission androID:name="androID.permission.INTERNET" />

我为应用程序编写的所有代码都在可移植的类库中.所以我还没有任何平台特定的代码.

如何从便携式类库检查并请求Internet许可

解决方法:

有“正常”和“危险”权限,互联网访问权限是一般权限,因此仅需在应用程序清单中定义即可进行安装,并且在运行时会自动授予该权限.

normal permissions cover areas where your app needs to access data or resources outsIDe the app’s sandBox, but where there’s very little risk to the user’s privacy or the operation of other apps. For example, permission to set the time zone is a normal permission. If an app declares that it needs a normal permission, the system automatically grants the permission to the app

参考:https://developer.android.com/guide/topics/security/normal-permissions.html

总结

以上是内存溢出为你收集整理的Ca-Xamarin Forms从PCL请求互联网许可Android 6全部内容,希望文章能够帮你解决Ca-Xamarin Forms从PCL请求互联网许可Android 6所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1091125.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存