Xamarin 简明教程
Xamarin - Permissions
在 Android 中,默认情况下,没有任何应用程序有权限对可能对用户或操作系统产生影响的任何操作执行操作。为了让 App 执行一项任务,它必须声明权限。在 Android 系统授予权限之前,App 无法执行此任务。此权限机制阻止应用程序在未经用户同意的情况下执行其希望的操作。
In Android, by default, no application has permissions to perform any operations that would have an effect on the user or the operating system. In order for an App to perform a task, it must declare the permissions. The App cannot perform the task until the permission are granted by the Android system. This mechanism of permissions stops applications from doing as they wish without the user’s consent.
权限将记录在 AndroidManifest.xml 文件中。要添加权限,请双击属性,然后转至 Android Man*所需的权限*将出现。选中你要添加的适当权限。
Permissions are to be recorded in AndroidManifest.xml file. To add permissions, we double-click on properties, then go to Android Man*Required permissions* will appear. Check the appropriate permissions you wish to add.
Camera − 它提供访问设备摄像头的权限。
Camera − It provides permission to access the device’s camera.
<uses-permission android:name="android.permission.CAMERA" />
Internet − 它提供对网络资源的访问。
Internet − It provides access to network resources.
<uses-permission android:name="android.permission.INTERNET" />
ReadContacts − 它提供访问设备上联系人的权限。
ReadContacts − It provides access to read the contacts on your device.
<uses-permission android:name="android.permission.READ_CONTACTS" />
ReadExternalStorage − 它提供对外部存储器读写数据的权限。
ReadExternalStorage − It provides access to read and store data on an external storage.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Calendars − 它允许应用程序访问用户设备上的日历和事件。此权限可能很危险,因为它赋予应用程序在所有者不知情的情况下向来宾发送电子邮件的能力。添加此权限的语法如下所示 −
Calendars − It allows an app access to the calendar on the user device and events. This permission can be dangerous, as it grants an app the ability to send emails to guests without the owner’s awareness. The syntax for adding this permission is as shown below −
<uses-permission android:name="android.permission-group.CALENADAR" />
SMS − 具有此权限的应用程序有能力使用设备的消息服务。它包括读取、写入和编辑短信和彩信。其语法如下所示。
SMS − An app with this permission has the ability to use the devices messaging services. It includes reading, writing, and editing SMS and MMS messages. Its syntax is as shown below.
<uses-permission android:name="android.permission-group.SMS" />
Location − 具有此权限的应用程序可以使用 GPS 网络访问设备的位置。
Location − An app with this permission can access the device’s location using the GPS network.
<uses-permission android:name="android.permission-group.LOCATION" />
Bluetooth − 具有此权限的应用程序可以使用蓝牙功能的设备无线地交换数据文件。
Bluetooth − An app with this permission can exchange data files with other Bluetooth enabled devices wirelessly.
<uses-permission android:name="android.permission.BLUETOOTH" />