首页 > 代码库 > Google I/O 2013 最佳实践(2) - AndroidManifest篇

Google I/O 2013 最佳实践(2) - AndroidManifest篇

<!--
  Copyright 2011 Google Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.android.apps.iosched"
    android:versionCode="110"
    android:versionName="1.1.0"
    android:installLocation="auto">

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.google.android.apps.iosched.permission.WRITE_SCHEDULE"
        android:protectionLevel="normal"
        android:label="@string/permission_write"
        android:description="@string/permission_write" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.NFC" />
    <!-- required for YouTube -->
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!-- required for setIsSyncable -->
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
    <!-- required for GCM -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission
            android:name="com.google.android.c2dm.permission.RECEIVE" />
    <permission
            android:name="com.google.android.apps.iosched.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
    <uses-permission
            android:name="com.google.android.apps.iosched.permission.C2D_MESSAGE" />

    <!-- required for MapView v2 -->
    <permission
        android:name="com.google.android.apps.iosched.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.google.android.apps.iosched.permission.MAPS_RECEIVE"/>
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
    <uses-feature
        android:name="android.hardware.location"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.location.gps"
        android:required="false" />

    <application
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:logo="@drawable/actionbar_logo"
        android:theme="@style/Theme.IOSched"
        android:hardwareAccelerated="true"
        android:allowBackup="true"
        android:supportsRtl="true">

        <!-- MapView v2 API -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value=http://www.mamicode.com/"@string/maps_api_key"/>>


android:installLocation="auto"

App安装在内置或外置SD卡上,默认为内置,此处设置为自动


<uses-feature />

用来过滤一些硬件不支持的设备,比如过滤不支持前置摄像头/不支持GPS的设备,不允许其安装。


android:logo="@drawable/actionbar_logo"

就是ActionBar左上角默认的logo图片


android:allwoBackup="true"

是否支持系统原生的备份功能,默认为true


剩下的没什么好说了,就不介绍了