fix crash due to thread calling things it should not call.
This commit is contained in:
parent
286081da79
commit
67d054f321
3 changed files with 13 additions and 4 deletions
|
@ -459,7 +459,7 @@ public class LinphoneManager implements LinphoneListener {
|
|||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
UIThreadDispatcher.Dispatch(new Runnable() {
|
||||
UIThreadDispatcher.dispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLc != null) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.os.Looper;
|
|||
public class UIThreadDispatcher {
|
||||
private static Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
public static void Dispatch(Runnable r) {
|
||||
public static void dispatch(Runnable r) {
|
||||
mHandler.post(r);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.UIThreadDispatcher;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -47,10 +48,18 @@ public class GCMService extends GCMBaseIntentService {
|
|||
protected void onMessage(Context context, Intent intent) {
|
||||
Log.d("Push notification received");
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
UIThreadDispatcher.dispatch(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0){
|
||||
LinphoneManager.getLc().setNetworkReachable(false);
|
||||
LinphoneManager.getLc().setNetworkReachable(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRegistered(Context context, String regId) {
|
||||
|
|
Loading…
Reference in a new issue