Fix incoming chat messages while in background
This commit is contained in:
parent
33c1553942
commit
a32c39f9ce
2 changed files with 7 additions and 4 deletions
|
@ -1243,6 +1243,8 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// Remove to avoid duplication of the listeners
|
||||
LinphoneManager.removeListener(this);
|
||||
LinphoneManager.addListener(this);
|
||||
|
||||
prepareContactsInBackground();
|
||||
|
@ -1267,15 +1269,15 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneManager.removeListener(this);
|
||||
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
refreshStatus(OnlineStatus.Away);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LinphoneManager.removeListener(this);
|
||||
|
||||
if (chatStorage != null) {
|
||||
chatStorage.close();
|
||||
chatStorage = null;
|
||||
|
|
|
@ -48,6 +48,7 @@ import java.util.TimerTask;
|
|||
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener.AudioState;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnMessageReceivedListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneServiceListener;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
|
@ -943,7 +944,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
for (LinphoneSimpleListener listener : getSimpleListeners(LinphoneActivity.class)) {
|
||||
((LinphoneActivity) listener).onMessageReceived(message.getFrom(), message);
|
||||
((LinphoneOnMessageReceivedListener) listener).onMessageReceived(message.getFrom(), message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue