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="@string/maps_api_key"/>

        <!-- Activities for both phones and tablets -->

        <activity
            android:name=".ui.AccountActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.IOSched.Accounts"
            android:configChanges="orientation|keyboardHidden" />

        <activity
            android:name=".ui.HomeActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.IOSched.Home">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.SocialStreamActivity"
            android:label="@string/title_tagstream"
            android:theme="@style/Theme.IOSched.PlusStream"
            android:parentActivityName=".ui.HomeActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
        </activity>

        <activity
            android:name=".ui.AnnouncementsActivity"
            android:label="@string/title_announcements"
            android:theme="@style/Theme.IOSched.PlusStream"
            android:parentActivityName=".ui.HomeActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
        </activity>

        <activity
            android:name=".ui.SearchActivity"
            android:label="@string/title_search"
            android:launchMode="singleTop"
            android:theme="@style/Theme.IOSched.GreyBackground"
            android:parentActivityName=".ui.HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
        </activity>

        <activity android:name=".ui.SessionLivestreamActivity"
            android:label="@string/session_livestream_title"
            android:configChanges="orientation|screenSize"
            android:theme="@style/Theme.IOSched.Livestream"
            android:parentActivityName=".ui.HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
        </activity>

        <activity
            android:name=".ui.SettingsActivity"
            android:label="@string/title_settings"
            android:theme="@style/Theme.IOSched"
            android:parentActivityName=".ui.HomeActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
        </activity>

        <activity
            android:name=".ui.NfcBadgeActivity"
            android:theme="@android:style/Theme.NoDisplay">
            <intent-filter android:priority="-999">
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="https" android:host="plus.google.com" />
            </intent-filter>
        </activity>

        <!-- Phone-only activities -->

        <activity
            android:name=".ui.phone.SessionsActivity"
            android:label="@string/title_sessions"
            android:parentActivityName=".ui.HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/vnd.iosched.session" />
            </intent-filter>
            <!-- HomeActivity and not TrackDetailActivity is the parent because SessionsActivity
              is not used to show sessions for a given track. -->
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="handset" />
        </activity>

        <activity
            android:name=".ui.phone.TrackDetailActivity"
            android:label="@string/title_tracks"
            android:theme="@style/Theme.IOSched.GreyBackground"
            android:parentActivityName=".ui.HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.track" />
            </intent-filter>
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="handset" />
        </activity>

        <activity android:name=".ui.phone.SessionDetailActivity"
            android:label="@string/title_session_detail"
            android:uiOptions="splitActionBarWhenNarrow"
            android:parentActivityName=".ui.phone.SessionsActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.session" />
            </intent-filter>
            <!-- Android Beam for session details -->
            <intent-filter>
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.session" />
            </intent-filter>
            <!-- Web URLs -->
            <intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https"
                    android:host="developers.google.com"
                    android:pathPrefix="/events/io/sessions/" />
            </intent-filter>
            <!-- PARENT_ACTIVITY alone is insufficient for Up navigation for this activity -->
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.phone.SessionsActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="handset" />
        </activity>

        <activity android:name=".ui.SessionFeedbackActivity"
            android:label="@string/title_session_feedback">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.session_feedback" />
            </intent-filter>
            <!-- PARENT_ACTIVITY alone is insufficient for Up navigation for this activity -->
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.phone.SessionsActivity" />
        </activity>

        <activity android:name=".ui.phone.SandboxDetailActivity"
            android:label="@string/title_sandbox_detail"
            android:parentActivityName=".ui.phone.TrackDetailActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.sandbox" />
            </intent-filter>
            <!-- PARENT_ACTIVITY alone is insufficient for Up navigation for this activity -->
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.phone.TrackDetailActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="handset" />
        </activity>

        <activity
            android:name=".ui.phone.MapActivity"
            android:label="@string/title_map"
            android:configChanges="orientation|keyboardHidden"
            android:parentActivityName=".ui.HomeActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="handset" />
        </activity>

        <!-- Tablet-only activities -->

        <activity
            android:name=".ui.tablet.SessionsSandboxMultiPaneActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.IOSched.GreyBackground"
            android:parentActivityName=".ui.HomeActivity">
            <!-- can show track details -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.track" />
            </intent-filter>
            <!-- can show session and sandbox company lists -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/vnd.iosched.session" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/vnd.iosched.sandbox" />
            </intent-filter>
            <!-- can show session and sandbox company details -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.session" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.sandbox" />
            </intent-filter>
            <!-- Android Beam for session details -->
            <intent-filter>
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.iosched.session" />
            </intent-filter>
            <!-- Web URLs -->
            <intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https"
                    android:host="developers.google.com"
                    android:pathPrefix="/events/io/sessions/" />
            </intent-filter>
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="tablet" />
        </activity>

        <activity
            android:name=".ui.tablet.MapMultiPaneActivity"
            android:label="@string/title_map"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:parentActivityName=".ui.HomeActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.HomeActivity" />
            <meta-data android:name="com.google.android.apps.iosched.meta.TARGET_FORM_FACTOR"
                android:value="tablet" />
        </activity>

        <!-- TaskStackBuilder proxy activity for widgets and notifications. -->

        <activity
            android:name=".ui.TaskStackBuilderProxyActivity"
            android:theme="@android:style/Theme.NoDisplay" />

        <!-- Session alarm/calendar integrating components. -->
        <receiver android:name=".receiver.SessionAlarmReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="com.google.android.apps.iosched.action.UPDATE_CALENDAR_COMPLETED" />
            </intent-filter>
        </receiver>

        <service android:name=".service.SessionAlarmService" />

        <!-- Used for install referral measurement-->
        <service android:name="com.google.analytics.tracking.android.CampaignTrackingService" />
        <receiver
            android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>

        <!--
          BroadcastReceiver that will receive the C2DM messages from GCM
          services and handle them to the custom IntentService.

          The com.google.android.c2dm.permission.SEND permission is necessary
          so only GCM services can send data messages for the app.
        -->
        <receiver android:name=".gcm.GCMRedirectedBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.google.android.apps.iosched" />
            </intent-filter>
        </receiver>

        <!--
          Application-specific subclass of GCMBaseIntentService that will
          handle received messages.

          By default, it must be named .GCMIntentService, unless the
          application uses a custom BroadcastReceiver that redefines its name.
        -->
        <service android:name=".gcm.GCMIntentService" />

        <!-- Data, sync and schedule editing components -->

        <provider
            android:name=".provider.ScheduleProvider"
            android:authorities="com.google.android.apps.iosched"
            android:writePermission="com.google.android.apps.iosched.permission.WRITE_SCHEDULE"
            android:syncable="true"
            android:label="@string/app_name"
            android:exported="true" />

        <service android:name=".service.ScheduleUpdaterService" />

        <service android:name=".sync.SyncService"
            android:exported="true"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>
            <meta-data android:name="android.content.SyncAdapter"
                android:resource="@xml/syncadapter" />
        </service>

        <!-- a simple receiver that triggers a sync for any message it receives. used by our
             GCM implementation -->
        <receiver android:name=".sync.TriggerSyncReceiver" />

        <!-- Other manifest items -->

        <meta-data
            android:name="android.app.default_searchable"
            android:value=".ui.SearchActivity" />

        <!-- App widget components -->

        <receiver android:name=".appwidget.ScheduleWidgetProvider"
            android:enabled="@bool/has_honeycomb">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <!-- This specifies the widget provider info -->
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/widgetinfo" />
        </receiver>

        <!-- The service serving the RemoteViews to the collection widget -->

        <service android:name=".appwidget.ScheduleWidgetRemoteViewsService"
            android:permission="android.permission.BIND_REMOTEVIEWS"
            android:exported="false"
            android:enabled="@bool/has_honeycomb" />

        <!-- DashClock extension -->
        <service android:name=".service.DashClockExtension"
            android:icon="@drawable/dashclock_extension"
            android:label="@string/app_name"
            android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
            <intent-filter>
                <action android:name="com.google.android.apps.dashclock.Extension" />
            </intent-filter>
            <meta-data android:name="protocolVersion" android:value="1" />
            <meta-data android:name="description"
                android:value="@string/dashclock_extension_description" />
        </service>
    </application>
</manifest>

android:installLocation="auto"

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

<uses-feature />

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

android:logo="@drawable/actionbar_logo"

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

android:allwoBackup="true"

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

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

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

时间: 2024-10-13 06:34:21

Google I/O 2013 最佳实践(2) - AndroidManifest篇的相关文章

Google I/O 2013 最佳实践(1) - res资源篇

最近在看Google I/O 2013 App源码,记录一下新学习到的新功能与方法,此篇先从res资源文件开始.先来看看目录结构: drawable-ldrtl-mdpi: ldrtl是layout-direction-right-to-left的缩写,意味着布局方式从右到左,主要是为了适配阿拉伯语用.这应该是API17,即Android4.2上新出的功能. drawable-nodpi: 此目录资源的文件会提供给任意密度的屏幕使用,系统不会因为屏幕密度的不同而放大该图片. drawable-s

web移动开发最佳实践之 css篇

web移动开发最佳实践之 css篇 一.css概述 css即层叠样式表(Cascading Style Sheets),它的作用主要是控制页面元素的样式,包括布局.颜色.字体.字号.空白.边框.属性等等.css的出现使得html的内容和样式分离,极大的提高了工作效率. 目前最新的标准是css3,下面几节将介绍在使用css过程中应遵循的最佳实践方案. 二.使用高效的css选择器 欲创建一个高效的web应用,你要了解浏览器是如何读取你的web页面并呈现出来的.当浏览器读取你的html文档时,它首先对

web移动开发最佳实践之 css篇 ——转

 web移动开发最佳实践之 css篇 一.css概述 css即层叠样式表(Cascading Style Sheets),它的作用主要是控制页面元素的样式,包括布局.颜色.字体.字号.空白.边框.属性等等.css的出现使得html的内容和样式分离,极大的提高了工作效率. 目前最新的标准是css3,下面几节将介绍在使用css过程中应遵循的最佳实践方案. 二.使用高效的css选择器 欲创建一个高效的web应用,你要了解浏览器是如何读取你的web页面并呈现出来的.当浏览器读取你的html文档时,它首先

Canvas 最佳实践(性能篇)

Canvas 想必前端同学们都不陌生,它是 HTML5 新增的「画布」元素,允许我们使用 JavaScript 来绘制图形.目前,所有的主流浏览器都支持 Canvas. Canvas 最常见的用途是渲染动画.渲染动画的基本原理,无非是反复地擦除和重绘.为了动画的流畅,留给我渲染一帧的时间,只有短短的 16ms.在这 16ms 中,我不仅需要处理一些游戏逻辑,计算每个对象的位置.状态,还需要把它们都画出来.如果消耗的时间稍稍多了一些,用户就会感受到「卡顿」.所以,在编写动画(和游戏)的时候,我无时

web移动开发最佳实践之js篇

一.js概述 js即JavaScript,是被设计用来验证表单.检测浏览器.创建cookies.改进设计以及更多应用的网络脚本语言,它非常容易使用.在web应用中,它是主要的编程语言,主要用途是进行各种逻辑控制.行为展现等.对于js的优化,对于整个应用的提升都是非常显著的. 二.使用字面量(literal notation)来声明对象和数组 创建对象和数组的方法有很多,但是使用字面量是最简单最快的.传统的方法是使用内建的构造器声明: //create an object var obj = ne

Web前端优化最佳实践及工具集锦

前端的性能对于一个Web应用来说非常重要,如果一个Web应用的页面加载速度非常快.对于用户的操作可以及时响应,那么产品的用户体验将会极大地提升.下图显示了页面加载速度对于用户体验的影响. 你的Web页面的速度是否已经足够快了?其实可能还有很多可以提升的地方.Google和雅虎也提出了一些Web应用的前端优化建议,并发布了一些工具,你可以逐一检验你的Web应用,以便达到更高的性能. 这些优化不仅仅可以给用户提供更好的体验,从开发者角度来说,进行优化还可以减少页面的请求数.降低请求所占的带宽.减少资

Hadoop MapReduce开发最佳实践(上篇)

body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif; font-size: 10.5pt; line-height: 1.5;}

Web 前端优化最佳实践

面向内容的优化规则目前有 10 条. 1. 尽量减少HTTP请求 (Make FewerHTTPRequests) 作为第一条,可能也是最重要的一条.根据 Yahoo! 研究团队的数据分析,有很大一部分用户访问会因为这一条而取得最大受益.有几种常见的方法能切实减少HTTP请求: 1) 合并文件,比如把多个CSS文件合成一个: 2) CSSSprites 利用CSSbackground 相关元素进行背景图绝对定位:参见:CSS Sprites: Image Slicing’s Kiss of De

paip.前端加载时间分析之道优化最佳实践

1.另存为 ,查看文件尺寸..和图片. 2.view the 另存为的htm静态的文件单个的加载,看时间...可以排除编程语言的问题and 数据库.. ##页面加载速度对于用户体验的影响. 1秒内,最好的.. 5秒, >>5秒 ,坏的.. ##index 一.Google的Web优化最佳实践 二.雅虎的Web优化最佳实践 2. 服务器优化 4. CSS优化 5. JavaScript优化 作者 老哇的爪子 Attilax 艾龙,  EMAIL:[email protected] 转载请注明来源