Fixes & improvements from github pull requests

This commit is contained in:
Sylvain Berfini 2018-09-24 10:16:51 +02:00
parent 824cbc39a5
commit 3de51146b7
4 changed files with 20 additions and 6 deletions

View file

@ -1358,7 +1358,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
mAudioManager.setMode(MODE_RINGTONE);
try {
if ((mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) && mVibrator != null) {
if ((mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL)
&& mVibrator != null) {
long[] patern = {0, 1000, 1000};
mVibrator.vibrate(patern, 1);
}
@ -1418,6 +1419,14 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
}
}
public boolean hasLinphoneAccount() {
for (ProxyConfig proxyConfig : mLc.getProxyConfigList()) {
if (getString(R.string.default_domain).equals(proxyConfig.getIdentityAddress().getDomain())) {
return true;
}
}
return false;
}
public static String extractADisplayName(Resources r, Address address) {
if (address == null) return r.getString(R.string.unknown_incoming_call_name);

View file

@ -426,10 +426,13 @@ public final class LinphoneService extends Service {
}
//make sure the application will at least wakes up every 10 mn
Intent keepAliveIntent = new Intent(this, KeepAliveReceiver.class);
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, keepAliveIntent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE));
Compatibility.scheduleAlarm(alarmManager, AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
if (LinphonePreferences.instance().isBackgroundModeEnabled() &&
(!LinphonePreferences.instance().isPushNotificationEnabled() || !LinphoneManager.getInstance().hasLinphoneAccount())) {
Intent keepAliveIntent = new Intent(this, KeepAliveReceiver.class);
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, keepAliveIntent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE));
Compatibility.scheduleAlarm(alarmManager, AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
}
return START_REDELIVER_INTENT;
}

View file

@ -996,8 +996,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
// changeCurrentFragment(FragmentsAvailable.DIALER, extras);
AddressType address = new AddressText(this, null);
address.setDisplayedName(name);
address.setText(number);
address.setDisplayedName(name);
LinphoneManager.getInstance().newOutgoingCall(address);
}

View file

@ -73,6 +73,8 @@ public class LinphoneLauncherActivity extends Activity {
addressToCall = addressToCall.replace("%3A", ":");
if (addressToCall.startsWith("sip:")) {
addressToCall = addressToCall.substring("sip:".length());
} else if (addressToCall.startsWith("tel:")) {
addressToCall = addressToCall.substring("tel:".length());
}
}
} else if (Intent.ACTION_VIEW.equals(action)) {