From 8cf42643f55d4de3fde59a780c0912d7b676171c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 19 Mar 2010 17:39:23 +0100 Subject: [PATCH] fix first configuration issue --- default.properties | 2 +- res/raw/linphonerc | 1 + src/org/linphone/AboutActivity.java | 1 - src/org/linphone/DialerActivity.java | 2 +- src/org/linphone/LinphoneService.java | 36 +++++++++++++-------------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/default.properties b/default.properties index 128c6ef18..19c96655d 100644 --- a/default.properties +++ b/default.properties @@ -10,4 +10,4 @@ # Indicates whether an apk should be generated for each density. split.density=false # Project target. -target=android-7 +target=android-4 diff --git a/res/raw/linphonerc b/res/raw/linphonerc index b0dfe00ad..234fb1092 100644 --- a/res/raw/linphonerc +++ b/res/raw/linphonerc @@ -13,6 +13,7 @@ use_info=0 use_ipv6=0 register_only_when_network_is_up=0 default_proxy=0 +auto_net_state_mon=0 [rtp] audio_rtp_port=7076 diff --git a/src/org/linphone/AboutActivity.java b/src/org/linphone/AboutActivity.java index 130135d01..3797305cd 100644 --- a/src/org/linphone/AboutActivity.java +++ b/src/org/linphone/AboutActivity.java @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package org.linphone; import android.app.Activity; -import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.util.Log; diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index ae100d3e3..9c750fe35 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -337,7 +337,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { } case GSTATE_CALL_OUT_INVITE: { enterIncalMode(lc); - routeAudioToSpeaker(); + routeAudioToReceiver(); break; } case GSTATE_CALL_IN_INVITE: { diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 186a9064a..285d0bd95 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -75,34 +75,33 @@ public class LinphoneService extends Service implements LinphoneCoreListener { public void onCreate() { super.onCreate(); theLinphone = this; - + mPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); try { copyAssetsFromPackage(); mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore( this - , new File(LINPHONE_RC) + , new File(LINPHONE_RC) , new File(LINPHONE_FACTORY_RC) , null); - - mLinphoneCore.setSoftPlayLevel(3); - initFromConf(); + mLinphoneCore.setSoftPlayLevel(3); + try { + initFromConf(); + } catch (LinphoneConfigException ec) { + Log.w(TAG,"no valid settings found",ec); + } TimerTask lTask = new TimerTask() { @Override public void run() { - mLinphoneCore.iterate(); + mLinphoneCore.iterate(); } }; - + mTimer.scheduleAtFixedRate(lTask, 0, 100); - - - - - - } catch (Exception e) { + } + catch (Exception e) { Log.e(TAG,"Cannot start linphone",e); } @@ -168,7 +167,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { Log.i(TAG, "new state ["+state+"]"); if (state == GeneralState.GSTATE_POWER_OFF) { //just exist - System.exit(0); + //System.exit(0); } if (DialerActivity.getDialer()!=null) { mHandler.post(new Runnable() { @@ -192,17 +191,17 @@ public class LinphoneService extends Service implements LinphoneCoreListener { public void initFromConf() throws LinphoneConfigException, LinphoneException { //1 read proxy config from preferences String lUserName = mPref.getString(getString(R.string.pref_username_key), null); - if (lUserName == null) { + if (lUserName == null || lUserName.length()==0) { throw new LinphoneConfigException(getString(R.string.wrong_username)); } String lPasswd = mPref.getString(getString(R.string.pref_passwd_key), null); - if (lPasswd == null) { + if (lPasswd == null || lPasswd.length()==0) { throw new LinphoneConfigException(getString(R.string.wrong_passwd)); } String lDomain = mPref.getString(getString(R.string.pref_domain_key), null); - if (lDomain == null) { + if (lDomain == null || lDomain.length()==0) { throw new LinphoneConfigException(getString(R.string.wrong_domain)); } @@ -243,7 +242,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { //escape + lDefaultProxyConfig.setDialEscapePlus(true); } - //init netwaork state + //init network state ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); mLinphoneCore.setNetworkStateReachable(lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED); @@ -269,6 +268,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { super.onDestroy(); mTimer.cancel(); mLinphoneCore.destroy(); + theLinphone=null; } } \ No newline at end of file