forked from organicmaps/organicmaps
[android] Catch 'app upgraded' intent.
(cherry picked from commit 7b8097f)
This commit is contained in:
parent
32244da39d
commit
6081643ac7
5 changed files with 62 additions and 2 deletions
|
@ -171,8 +171,8 @@
|
|||
<activity
|
||||
android:name="com.mapswithme.maps.MWMActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
|
||||
android:theme="@style/MwmTheme.Map">
|
||||
android:theme="@style/MwmTheme.Map"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
@ -323,6 +323,25 @@
|
|||
<category android:name="${applicationId}"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Catches app upgraded intent.
|
||||
Different receivers are used due to MY_PACKAGE_REPLACED was added in Honeycomb_MR1-->
|
||||
<receiver android:name=".background.UpgradeReceiver"
|
||||
android:enabled="@bool/isNewerThanHoneycombMr1">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".background.UpgradeReceiverCompat"
|
||||
android:enabled="@bool/isOlderThanHoneycombMr1">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
|
||||
|
||||
<data android:scheme="package"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
5
android/res/values-v12/version-checks.xml
Normal file
5
android/res/values-v12/version-checks.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<bool name="isNewerThanHoneycombMr1">true</bool>
|
||||
<bool name="isOlderThanHoneycombMr1">false</bool>
|
||||
</resources>
|
5
android/res/values/version-checks.xml
Normal file
5
android/res/values/version-checks.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<bool name="isNewerThanHoneycombMr1">false</bool>
|
||||
<bool name="isOlderThanHoneycombMr1">true</bool>
|
||||
</resources>
|
|
@ -0,0 +1,14 @@
|
|||
package com.mapswithme.maps.background;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class UpgradeReceiver extends BroadcastReceiver
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
// TODO our package's updated, do smth
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.mapswithme.maps.background;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class UpgradeReceiverCompat extends BroadcastReceiver
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
if (context.getPackageName().equals(intent.getData().getSchemeSpecificPart()))
|
||||
{
|
||||
// TODO our package's updated, do smth
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue