diff --git a/app/src/main/java/org/linphone/LinphoneManager.java b/app/src/main/java/org/linphone/LinphoneManager.java
index ecb41084d..a4c965954 100644
--- a/app/src/main/java/org/linphone/LinphoneManager.java
+++ b/app/src/main/java/org/linphone/LinphoneManager.java
@@ -20,10 +20,8 @@
package org.linphone;
import android.annotation.SuppressLint;
-import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
@@ -31,7 +29,6 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
-import android.net.Uri;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.telephony.PhoneStateListener;
@@ -64,7 +61,6 @@ import org.linphone.core.ProxyConfig;
import org.linphone.core.Reason;
import org.linphone.core.Tunnel;
import org.linphone.core.TunnelConfig;
-import org.linphone.core.VersionUpdateCheckResult;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.LinphoneUtils;
@@ -216,50 +212,6 @@ public class LinphoneManager implements SensorEventListener {
}
}
- @Override
- public void onVersionUpdateCheckResultReceived(
- Core core,
- VersionUpdateCheckResult result,
- String version,
- String url) {
- if (result == VersionUpdateCheckResult.NewVersionAvailable) {
- final String urlToUse = url;
- final String versionAv = version;
- LinphoneUtils.dispatchOnUIThreadAfter(
- new Runnable() {
- @Override
- public void run() {
- AlertDialog.Builder builder =
- new AlertDialog.Builder(mContext);
- builder.setMessage(
- getString(R.string.update_available)
- + ": "
- + versionAv);
- builder.setCancelable(false);
- builder.setNeutralButton(
- getString(R.string.ok),
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(
- DialogInterface dialogInterface,
- int i) {
- if (urlToUse != null) {
- Intent urlIntent =
- new Intent(
- Intent.ACTION_VIEW);
- urlIntent.setData(
- Uri.parse(urlToUse));
- mContext.startActivity(urlIntent);
- }
- }
- });
- builder.show();
- }
- },
- 1000);
- }
- }
-
@Override
public void onFriendListCreated(Core core, FriendList list) {
if (LinphoneContext.isReady()) {
@@ -793,20 +745,6 @@ public class LinphoneManager implements SensorEventListener {
/* Other stuff */
- public void checkForUpdate() {
- String url = LinphonePreferences.instance().getCheckReleaseUrl();
- if (url != null && !url.isEmpty()) {
- int lastTimestamp = LinphonePreferences.instance().getLastCheckReleaseTimestamp();
- int currentTimeStamp = (int) System.currentTimeMillis();
- int interval =
- mContext.getResources().getInteger(R.integer.time_between_update_check); // 24h
- if (lastTimestamp == 0 || currentTimeStamp - lastTimestamp >= interval) {
- mCore.checkForUpdate(BuildConfig.VERSION_NAME);
- LinphonePreferences.instance().setLastCheckReleaseTimestamp(currentTimeStamp);
- }
- }
- }
-
public void enableDeviceRingtone(boolean use) {
if (use) {
mCore.setRing(null);
diff --git a/app/src/main/java/org/linphone/activities/LinphoneLauncherActivity.java b/app/src/main/java/org/linphone/activities/LinphoneLauncherActivity.java
index 22a10fc3a..3ab8d80ad 100644
--- a/app/src/main/java/org/linphone/activities/LinphoneLauncherActivity.java
+++ b/app/src/main/java/org/linphone/activities/LinphoneLauncherActivity.java
@@ -94,10 +94,6 @@ public class LinphoneLauncherActivity extends Activity implements ServiceWaitThr
}
}
- if (getResources().getBoolean(R.bool.check_for_update_when_app_starts)) {
- LinphoneManager.getInstance().checkForUpdate();
- }
-
Intent intent = new Intent();
intent.setClass(LinphoneLauncherActivity.this, classToStart);
if (getIntent() != null && getIntent().getExtras() != null) {
diff --git a/app/src/main/java/org/linphone/dialer/DialerActivity.java b/app/src/main/java/org/linphone/dialer/DialerActivity.java
index b5f18ca90..e1e5ceb15 100644
--- a/app/src/main/java/org/linphone/dialer/DialerActivity.java
+++ b/app/src/main/java/org/linphone/dialer/DialerActivity.java
@@ -20,6 +20,8 @@
package org.linphone.dialer;
import android.Manifest;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -35,6 +37,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
+import org.linphone.BuildConfig;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.activities.MainActivity;
@@ -44,11 +47,13 @@ import org.linphone.contacts.ContactsManager;
import org.linphone.core.Call;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
+import org.linphone.core.VersionUpdateCheckResult;
import org.linphone.core.tools.Log;
import org.linphone.dialer.views.AddressText;
import org.linphone.dialer.views.Digit;
import org.linphone.dialer.views.EraseButton;
import org.linphone.settings.LinphonePreferences;
+import org.linphone.utils.LinphoneUtils;
public class DialerActivity extends MainActivity implements AddressText.AddressChangedListener {
private static final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched";
@@ -103,6 +108,50 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
Core core, Call call, Call.State state, String message) {
updateLayout();
}
+
+ @Override
+ public void onVersionUpdateCheckResultReceived(
+ Core core,
+ VersionUpdateCheckResult result,
+ String version,
+ String url) {
+ if (result == VersionUpdateCheckResult.NewVersionAvailable) {
+ final String urlToUse = url;
+ final String versionAv = version;
+ LinphoneUtils.dispatchOnUIThreadAfter(
+ new Runnable() {
+ @Override
+ public void run() {
+ AlertDialog.Builder builder =
+ new AlertDialog.Builder(DialerActivity.this);
+ builder.setMessage(
+ getString(R.string.update_available)
+ + ": "
+ + versionAv);
+ builder.setCancelable(false);
+ builder.setNeutralButton(
+ getString(R.string.ok),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(
+ DialogInterface dialogInterface,
+ int i) {
+ if (urlToUse != null) {
+ Intent urlIntent =
+ new Intent(
+ Intent.ACTION_VIEW);
+ urlIntent.setData(
+ Uri.parse(urlToUse));
+ startActivity(urlIntent);
+ }
+ }
+ });
+ builder.show();
+ }
+ },
+ 1000);
+ }
+ }
};
// On dialer we ask for all permissions
@@ -181,6 +230,28 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
super.onDestroy();
}
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ if (getResources().getBoolean(R.bool.check_for_update_when_app_starts)) {
+ checkForUpdate();
+ }
+ }
+
+ private void checkForUpdate() {
+ String url = LinphonePreferences.instance().getCheckReleaseUrl();
+ if (url != null && !url.isEmpty()) {
+ int lastTimestamp = LinphonePreferences.instance().getLastCheckReleaseTimestamp();
+ int currentTimeStamp = (int) System.currentTimeMillis();
+ int interval = getResources().getInteger(R.integer.time_between_update_check); // 24h
+ if (lastTimestamp == 0 || currentTimeStamp - lastTimestamp >= interval) {
+ LinphoneManager.getCore().checkForUpdate(BuildConfig.VERSION_NAME);
+ LinphonePreferences.instance().setLastCheckReleaseTimestamp(currentTimeStamp);
+ }
+ }
+ }
+
private void initUI(View view) {
mAddress = view.findViewById(R.id.address);
mAddress.setAddressListener(this);
diff --git a/app/src/main/res/values/non_localizable_custom.xml b/app/src/main/res/values/non_localizable_custom.xml
index 9937cac61..6245f96f5 100644
--- a/app/src/main/res/values/non_localizable_custom.xml
+++ b/app/src/main/res/values/non_localizable_custom.xml
@@ -18,7 +18,7 @@
LinphoneAndroid
linphone-android-photo-temp
linphone-android-photo-%s
- GNU General Public License V3\n © 2010–2019 Belledonne Communications
+ GNU General Public License V3\n © 2010–2020 Belledonne Communications
linphone-android@belledonne-communications.com
linphone_notification_service_id
linphone_notification_id