fix first configuration issue

This commit is contained in:
Jehan Monnier 2010-03-19 17:39:23 +01:00
parent 39c0604397
commit 8cf42643f5
5 changed files with 21 additions and 21 deletions

View file

@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density. # Indicates whether an apk should be generated for each density.
split.density=false split.density=false
# Project target. # Project target.
target=android-7 target=android-4

View file

@ -13,6 +13,7 @@ use_info=0
use_ipv6=0 use_ipv6=0
register_only_when_network_is_up=0 register_only_when_network_is_up=0
default_proxy=0 default_proxy=0
auto_net_state_mon=0
[rtp] [rtp]
audio_rtp_port=7076 audio_rtp_port=7076

View file

@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone; package org.linphone;
import android.app.Activity; import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;

View file

@ -337,7 +337,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} }
case GSTATE_CALL_OUT_INVITE: { case GSTATE_CALL_OUT_INVITE: {
enterIncalMode(lc); enterIncalMode(lc);
routeAudioToSpeaker(); routeAudioToReceiver();
break; break;
} }
case GSTATE_CALL_IN_INVITE: { case GSTATE_CALL_IN_INVITE: {

View file

@ -81,28 +81,27 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
copyAssetsFromPackage(); copyAssetsFromPackage();
mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore( this mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore( this
, new File(LINPHONE_RC) , new File(LINPHONE_RC)
, new File(LINPHONE_FACTORY_RC) , new File(LINPHONE_FACTORY_RC)
, null); , null);
mLinphoneCore.setSoftPlayLevel(3); mLinphoneCore.setSoftPlayLevel(3);
initFromConf(); try {
initFromConf();
} catch (LinphoneConfigException ec) {
Log.w(TAG,"no valid settings found",ec);
}
TimerTask lTask = new TimerTask() { TimerTask lTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
mLinphoneCore.iterate(); mLinphoneCore.iterate();
} }
}; };
mTimer.scheduleAtFixedRate(lTask, 0, 100); mTimer.scheduleAtFixedRate(lTask, 0, 100);
}
catch (Exception e) {
} catch (Exception e) {
Log.e(TAG,"Cannot start linphone",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+"]"); Log.i(TAG, "new state ["+state+"]");
if (state == GeneralState.GSTATE_POWER_OFF) { if (state == GeneralState.GSTATE_POWER_OFF) {
//just exist //just exist
System.exit(0); //System.exit(0);
} }
if (DialerActivity.getDialer()!=null) { if (DialerActivity.getDialer()!=null) {
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@ -192,17 +191,17 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
public void initFromConf() throws LinphoneConfigException, LinphoneException { public void initFromConf() throws LinphoneConfigException, LinphoneException {
//1 read proxy config from preferences //1 read proxy config from preferences
String lUserName = mPref.getString(getString(R.string.pref_username_key), null); 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)); throw new LinphoneConfigException(getString(R.string.wrong_username));
} }
String lPasswd = mPref.getString(getString(R.string.pref_passwd_key), null); 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)); throw new LinphoneConfigException(getString(R.string.wrong_passwd));
} }
String lDomain = mPref.getString(getString(R.string.pref_domain_key), null); 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)); throw new LinphoneConfigException(getString(R.string.wrong_domain));
} }
@ -243,7 +242,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
//escape + //escape +
lDefaultProxyConfig.setDialEscapePlus(true); lDefaultProxyConfig.setDialEscapePlus(true);
} }
//init netwaork 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); mLinphoneCore.setNetworkStateReachable(lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED);
@ -269,6 +268,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
super.onDestroy(); super.onDestroy();
mTimer.cancel(); mTimer.cancel();
mLinphoneCore.destroy(); mLinphoneCore.destroy();
theLinphone=null;
} }
} }