development
Revision | 1917a19f3faa5e632b2c7a29c243c6fae0986af4 (tree) |
---|---|
Zeit | 2011-02-26 09:16:56 |
Autor | Dianne Hackborn <hackbod@goog...> |
Commiter | Android (Google) Code Review |
Merge "New API demo showing how to execute when app is updated."
@@ -875,6 +875,16 @@ | ||
875 | 875 | </intent-filter> |
876 | 876 | </activity> |
877 | 877 | |
878 | + <!-- Application Updating Samples --> | |
879 | + | |
880 | +<!-- BEGIN_INCLUDE(app_update_declaration) --> | |
881 | + <receiver android:name=".app.AppUpdateReceiver"> | |
882 | + <intent-filter> | |
883 | + <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> | |
884 | + </intent-filter> | |
885 | + </receiver> | |
886 | +<!-- END_INCLUDE(app_update_declaration) --> | |
887 | + | |
878 | 888 | <!-- ************************************* --> |
879 | 889 | <!-- PREFERENCE PACKAGE SAMPLES --> |
880 | 890 | <!-- ************************************* --> |
@@ -317,6 +317,8 @@ | ||
317 | 317 | <string name="text_to_speech">App/Text-To-Speech</string> |
318 | 318 | <string name="again">Again</string> |
319 | 319 | |
320 | + <string name="app_update_received">ApiDemos has been updated!</string> | |
321 | + | |
320 | 322 | <!-- ============================== --> |
321 | 323 | <!-- app/content examples strings --> |
322 | 324 | <!-- ============================== --> |
@@ -0,0 +1,34 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2011 The Android Open Source Project | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | + * Unless required by applicable law or agreed to in writing, software | |
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + * See the License for the specific language governing permissions and | |
14 | + * limitations under the License. | |
15 | + */ | |
16 | + | |
17 | +package com.example.android.apis.app; | |
18 | + | |
19 | +import com.example.android.apis.R; | |
20 | + | |
21 | +import android.content.BroadcastReceiver; | |
22 | +import android.content.Context; | |
23 | +import android.content.Intent; | |
24 | +import android.widget.Toast; | |
25 | + | |
26 | +/** | |
27 | + * Executed when a new version of the application is is installed. | |
28 | + */ | |
29 | +public class AppUpdateReceiver extends BroadcastReceiver { | |
30 | + @Override | |
31 | + public void onReceive(Context context, Intent intent) { | |
32 | + Toast.makeText(context, R.string.app_update_received, Toast.LENGTH_SHORT).show(); | |
33 | + } | |
34 | +} | |
\ No newline at end of file |