diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 966903cc0..013e0b604 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -1396,9 +1396,17 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick if (intent.getStringExtra("msgShared") != null) displayChat(null, intent.getStringExtra("msgShared")); - doNotGoToCallActivity = false; isOnBackground = false; + + if (intent != null) { + Bundle extras = intent.getExtras(); + if (extras != null && extras.containsKey("SipUriOrNumber")) { + mAddressWaitingToBeCalled = extras.getString("SipUriOrNumber"); + intent.removeExtra("SipUriOrNumber"); + goToDialerFragment(); + } + } } @Override @@ -1430,8 +1438,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - - if (getCurrentFragment() == FragmentsAvailable.SETTINGS) { if (fragment instanceof SettingsFragment) { @@ -1449,9 +1455,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick doNotGoToCallActivity = true; changeCurrentFragment(FragmentsAvailable.HISTORY_LIST, null); } else if (extras != null && extras.getBoolean("GoToInapp", false)) { - LinphoneService.instance().removeMessageNotification(); - doNotGoToCallActivity = true; - displayInapp(); + LinphoneService.instance().removeMessageNotification(); + doNotGoToCallActivity = true; + displayInapp(); } else if (extras != null && extras.getBoolean("Notification", false)) { if (LinphoneManager.getLc().getCallsNb() > 0) { LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; diff --git a/src/android/org/linphone/LinphoneLauncherActivity.java b/src/android/org/linphone/LinphoneLauncherActivity.java index c080d027e..5df0bf897 100644 --- a/src/android/org/linphone/LinphoneLauncherActivity.java +++ b/src/android/org/linphone/LinphoneLauncherActivity.java @@ -28,6 +28,7 @@ import org.linphone.tutorials.TutorialLauncherActivity; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -43,6 +44,7 @@ public class LinphoneLauncherActivity extends Activity { private Handler mHandler; private ServiceWaitThread mServiceThread; private String addressToCall; + private Uri uriToResolve; @Override protected void onCreate(Bundle savedInstanceState) { @@ -56,16 +58,6 @@ public class LinphoneLauncherActivity extends Activity { mHandler = new Handler(); - - if (LinphoneService.isReady()) { - onServiceReady(); - } else { - // start linphone as background - startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); - mServiceThread = new ServiceWaitThread(); - mServiceThread.start(); - } - Intent intent = getIntent(); if (intent != null) { String action = intent.getAction(); @@ -78,8 +70,23 @@ public class LinphoneLauncherActivity extends Activity { addressToCall = addressToCall.substring("sip:".length()); } } + } else if (Intent.ACTION_VIEW.equals(action)) { + if (LinphoneService.isReady()) { + addressToCall = ContactsManager.getInstance().getAddressOrNumberForAndroidContact(getContentResolver(), intent.getData()); + } else { + uriToResolve = intent.getData(); + } } } + + if (LinphoneService.isReady()) { + onServiceReady(); + } else { + // start linphone as background + startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); + mServiceThread = new ServiceWaitThread(); + mServiceThread.start(); + } } protected void onServiceReady() { @@ -114,6 +121,11 @@ public class LinphoneLauncherActivity extends Activity { } } } + if (uriToResolve != null) { + addressToCall = ContactsManager.getInstance().getAddressOrNumberForAndroidContact(getContentResolver(), uriToResolve); + Log.i("Intent has uri to resolve : " + uriToResolve.toString()); + uriToResolve = null; + } if (addressToCall != null) { newIntent.putExtra("SipUriOrNumber", addressToCall); Log.i("Intent has address to call : " + addressToCall);