Google I/O 2013 最佳实践(2) - AndroidManifest篇
时间:2014-05-22 08:41:44
收藏:0
阅读:377
<!-- 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
剩下的没什么好说了,就不介绍了
评论(0)