最近发现写博客对于成为一名优秀的程序员是多么的重要。
我励志成为一名优秀程序员,所以我要开始写博客。
作为一名刚入门的Android程序员,我的博客从安卓开发开始。
Android为了保证应用的安全性,做了规定,如果你的程序想要访问一些系统的关键信息,就必须在配置文件中声明相应的权限。
(要查看所有可以声明的权限,可以访问:http://developer.android.com/reference/android/Manifest.permission.html
短截图如下
)
声明权限的方式举例(红色字体部分声明了一个获取网络状态的权限)
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bignerdranch.android.sms_app" > <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>