fix crash on simulator when setting display name

This commit is contained in:
Jehan Monnier 2010-04-08 11:09:05 +02:00
parent b9af736651
commit 26713913fb
3 changed files with 8 additions and 5 deletions

View file

@ -35,10 +35,8 @@ import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.LinphoneCore.GeneralState; import org.linphone.core.LinphoneCore.GeneralState;
import android.app.AlertDialog;
import android.app.Service; import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
@ -253,7 +251,8 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
} }
//init network state //init network state
ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
mLinphoneCore.setNetworkStateReachable(lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED); NetworkInfo lInfo = lConnectivityManager.getActiveNetworkInfo();
mLinphoneCore.setNetworkStateReachable( lInfo !=null? lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED:false);
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
throw new LinphoneConfigException(getString(R.string.wrong_settings),e); throw new LinphoneConfigException(getString(R.string.wrong_settings),e);

View file

@ -29,13 +29,17 @@ public class LinphoneAddressImpl implements LinphoneAddress {
private native String getUserName(long ptr); private native String getUserName(long ptr);
private native String getDomain(long ptr); private native String getDomain(long ptr);
private native String toUri(long ptr); private native String toUri(long ptr);
private native String setDisplayName(long ptr,String name); private native void setDisplayName(long ptr,String name);
private native String toString(long ptr); private native String toString(long ptr);
protected LinphoneAddressImpl(String username,String domain,String displayName) { protected LinphoneAddressImpl(String username,String domain,String displayName) {
nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName);
} }
protected LinphoneAddressImpl(long aNativePtr,boolean javaOwnPtr) {
nativePtr = aNativePtr;
ownPtr=javaOwnPtr;
}
protected LinphoneAddressImpl(long aNativePtr) { protected LinphoneAddressImpl(long aNativePtr) {
nativePtr = aNativePtr; nativePtr = aNativePtr;
ownPtr=false; ownPtr=false;

View file

@ -177,7 +177,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException { public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException {
long lAddress = interpretUrl(nativePtr,destination); long lAddress = interpretUrl(nativePtr,destination);
if (lAddress != 0) { if (lAddress != 0) {
return new LinphoneAddressImpl(lAddress); return new LinphoneAddressImpl(lAddress,true);
} else { } else {
throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); throw new LinphoneCoreException("Cannot interpret ["+destination+"]");
} }