官术网_书友最值得收藏!

Permissions

With application sandboxing, apps cannot access parts of the system without permission, but even with it, Android allows data sharing with other apps or access to some system services. An app needs to request permission to access device data or to access system services. Permissions are a security feature of Android system, but misused permissions make your application vulnerable.

The permission needs of an app are declared in its manifest file. This manifest file is bundled into the app's Android application package (APK), which includes its compiled code along with other resources. The permissions requested in the manifest file (manifest permissions) will be shown to the user when installing the app. The user should review these permissions and accept them to complete the installation process. If the user agrees to them, the protected resources are available to the app.

Tip

Do not request permissions that your app does not need. Reducing the number of permissions makes your app less vulnerable.

Permissions control how an app interacts with the system by using an Android application programming interface (API). Some of the protected APIs that need permission include the following:

  • Bluetooth
  • Camera
  • Location GPS
  • Network and data connections
  • NFC
  • SMS and MMS
  • Telephony

For example, to request permission to use the camera, you have to add the following line code in our manifest file:

<uses-permission android:name="android.permission.CAMERA" />

The following code is used to request permission to access the Internet:

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

The following code is used to request permission to send a SMS:

<uses-permission android:name="android.permission.SEND_SMS" />
主站蜘蛛池模板: 海淀区| 南宫市| 灵丘县| 林州市| 溧阳市| 西丰县| 昂仁县| 上虞市| 灵武市| 龙海市| 华亭县| 远安县| 灵丘县| 罗源县| 广河县| 永清县| 邹平县| 乌鲁木齐县| 鄂州市| 彭州市| 黑龙江省| 文山县| 遵化市| 洛宁县| 望江县| 汨罗市| 万盛区| 马尔康县| 两当县| 武定县| 博罗县| 湖南省| 石渠县| 罗田县| 长汀县| 二手房| 巩留县| 岑巩县| 西充县| 崇仁县| 鸡西市|