diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 935bafab0..c91583aec 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="106" + android:versionName="1.06"> diff --git a/libs/armeabi/liblinphone.so b/libs/armeabi/liblinphone.so new file mode 100755 index 000000000..9d92ff99b Binary files /dev/null and b/libs/armeabi/liblinphone.so differ diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml index f2669c602..6e678442f 100644 --- a/res/values/non_localizable_strings.xml +++ b/res/values/non_localizable_strings.xml @@ -5,4 +5,6 @@ pref_domain_key pref_passwd_key pref_username_key + pref_debug_key + diff --git a/res/values/strings.xml b/res/values/strings.xml index a54af0e0a..0d401dd68 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,20 +1,21 @@ - Linphone %s SIP (rfc 3261) Compatible Internet phone \n http://www.linphone.org - About - Audio - Exit - Prefix - Advanced - Settings - Proxy - Domain* - Password* - Username* - Hello World, Linphone! - Linphone - SIP Account - wrong user name +Debug +Linphone %s SIP (rfc 3261) Compatible Internet phone \n http://www.linphone.org +About +Audio +Exit +Prefix +Advanced +Settings +Proxy +Domain* +Password* +Username* +Hello World, Linphone! +Linphone +SIP Account +wrong user name wrong password Wrong domain Wrong settings @@ -23,7 +24,9 @@ Cannot call %s Yes No +Never remind me %s, do you want to return to the settings page ? +No initial config found, do you want to return to the settings page ? Cannot initiate a new call because a call is already engaged History Cannot build destination address from [%s] diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index c160892aa..3cf3dcab7 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -13,6 +13,8 @@ - + + + diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index 93319abe7..292057e04 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -25,11 +25,15 @@ import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneCore.GeneralState; import android.app.Activity; +import android.app.AlertDialog; import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; import android.media.AudioManager; import android.os.Build; import android.os.Bundle; import android.os.PowerManager; +import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; @@ -81,7 +85,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { private String mDisplayName; private AudioManager mAudioManager; private PowerManager.WakeLock mWakeLock; + private SharedPreferences mPref; + String PREF_CHECK_CONFIG = "pref_check_config"; /** * * @return null if not ready yet @@ -103,7 +109,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE)); PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"Linphone"); - + mPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); try { @@ -329,6 +335,34 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { case GSTATE_POWER_ON: mCall.setEnabled(!lc.isIncall()); mHangup.setEnabled(!mCall.isEnabled()); + try{ + LinphoneService.instance().initFromConf(); + } catch (LinphoneConfigException ec) { + Log.w(LinphoneService.TAG,"no valid settings found",ec); + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(getString(R.string.initial_config_error)) + .setCancelable(false) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + LinphoneActivity.instance().startprefActivity(); + } + }).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + + } + }).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit(); + dialog.cancel(); + } + }); + if (mPref.getBoolean(PREF_CHECK_CONFIG, false) == false) { + builder.create().show(); + } + } catch (Exception e ) { + Log.e(LinphoneService.TAG,"Cannot get initial config", e); + } break; case GSTATE_REG_OK: { break; diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index df8a3aacb..43cae6b89 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -172,7 +172,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener return false; } - private void startprefActivity() { + protected void startprefActivity() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(this, LinphonePreferencesActivity.class); startActivity(intent); diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index fa74459ff..97542837d 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -35,8 +35,10 @@ import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneCore.GeneralState; +import android.app.AlertDialog; import android.app.Service; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; @@ -86,11 +88,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { , null); mLinphoneCore.setSoftPlayLevel(3); - try { - initFromConf(); - } catch (LinphoneConfigException ec) { - Log.w(TAG,"no valid settings found",ec); - } + TimerTask lTask = new TimerTask() { @Override public void run() { @@ -189,6 +187,10 @@ public class LinphoneService extends Service implements LinphoneCoreListener { public void initFromConf() throws LinphoneConfigException, LinphoneException { + //traces + boolean lIsDebug = mPref.getBoolean(getString(R.string.pref_debug_key), false); + LinphoneCoreFactory.instance().setDebugMode(lIsDebug); + //1 read proxy config from preferences String lUserName = mPref.getString(getString(R.string.pref_username_key), null); if (lUserName == null || lUserName.length()==0) { @@ -213,8 +215,10 @@ public class LinphoneService extends Service implements LinphoneCoreListener { //proxy - String lProxy = mPref.getString(getString(R.string.pref_proxy_key), "sip:"+lDomain); - + String lProxy = mPref.getString(getString(R.string.pref_proxy_key),null); + if (lProxy == null || lProxy.length() == 0) { + lProxy = "sip:"+lDomain; + } //get Default proxy if any LinphoneProxyConfig lDefaultProxyConfig = mLinphoneCore.getDefaultProxyConfig(); String lIdentity = "sip:"+lUserName+"@"+lDomain; @@ -247,7 +251,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { mLinphoneCore.setNetworkStateReachable(lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED); } catch (LinphoneCoreException e) { - throw new LinphoneConfigException(getString(R.string.wrong_settings)); + throw new LinphoneConfigException(getString(R.string.wrong_settings),e); } } diff --git a/src/org/linphone/core/LinphoneCoreFactory.java b/src/org/linphone/core/LinphoneCoreFactory.java index 4cbded4f9..24315f6dd 100644 --- a/src/org/linphone/core/LinphoneCoreFactory.java +++ b/src/org/linphone/core/LinphoneCoreFactory.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; public class LinphoneCoreFactory { + static { System.loadLibrary("linphone"); } @@ -42,6 +43,11 @@ public class LinphoneCoreFactory { public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) { return new LinphoneAddressImpl(username,domain,displayName); } - + + /** + * Enable verbose traces + * @param enable + */ + public native void setDebugMode(boolean enable); }