Fixes for push notifications

This commit is contained in:
Sylvain Berfini 2016-05-04 15:22:48 +02:00
parent 7a0d03932c
commit b6edbee3cc
3 changed files with 1 additions and 16 deletions

View file

@ -988,6 +988,7 @@ public class LinphonePreferences {
public void setPushNotificationRegistrationID(String regId) {
getConfig().setString("app", "push_notification_regid", regId);
setPushNotificationEnabled(isPushNotificationEnabled());
}
public String getPushNotificationRegistrationID() {

View file

@ -172,20 +172,6 @@ public final class LinphoneService extends Service {
if (state == LinphoneCall.State.IncomingReceived) {
onIncomingReceived();
}
if (state == State.CallUpdatedByRemote) {
// If the correspondent proposes video while audio call
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
try {
LinphoneManager.getLc().deferCallUpdate(call);
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
if (state == State.StreamsRunning) {
// Workaround bug current call seems to be updated after state changed to streams running

View file

@ -48,9 +48,7 @@ public class ApiEightPlus {
String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID();
if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) {
GCMRegistrar.getMethod("register", Context.class, String[].class).invoke(null, context, new String[]{newPushSenderID});
Log.d("Push Notification: storing current sender id = " + newPushSenderID);
LinphonePreferences.instance().setPushNotificationRegistrationID(newPushSenderID);
} else {
Log.d("Push Notification: already registered with id = " + regId);
LinphonePreferences.instance().setPushNotificationRegistrationID(regId);