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.
split.density=false
# Project target.
target=android-7
target=android-4

View file

@ -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

View file

@ -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;

View file

@ -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: {

View file

@ -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;
}
}