• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

development


Commit MetaInfo

Revision1917a19f3faa5e632b2c7a29c243c6fae0986af4 (tree)
Zeit2011-02-26 09:16:56
AutorDianne Hackborn <hackbod@goog...>
CommiterAndroid (Google) Code Review

Log Message

Merge "New API demo showing how to execute when app is updated."

Ändern Zusammenfassung

Diff

--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -875,6 +875,16 @@
875875 </intent-filter>
876876 </activity>
877877
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+
878888 <!-- ************************************* -->
879889 <!-- PREFERENCE PACKAGE SAMPLES -->
880890 <!-- ************************************* -->
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -317,6 +317,8 @@
317317 <string name="text_to_speech">App/Text-To-Speech</string>
318318 <string name="again">Again</string>
319319
320+ <string name="app_update_received">ApiDemos has been updated!</string>
321+
320322 <!-- ============================== -->
321323 <!-- app/content examples strings -->
322324 <!-- ============================== -->
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/AppUpdateReceiver.java
@@ -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