Fix calls from native dialer.

This commit is contained in:
Guillaume Beraudo 2011-12-13 12:04:47 +01:00
parent f6afe8b15e
commit d198bef5a1
3 changed files with 23 additions and 17 deletions

View file

@ -16,19 +16,6 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity>
<activity android:name="org.linphone.LinphoneActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
> <!-- android:alwaysRetainTaskState="true" clearTaskOnLaunch="false"-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CALL" /> <action android:name="android.intent.action.CALL" />
@ -46,6 +33,20 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.LinphoneActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
> <!-- android:alwaysRetainTaskState="true" clearTaskOnLaunch="false"-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.IncomingCallActivity" <activity android:name="org.linphone.IncomingCallActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleInstance"> android:launchMode="singleInstance">

View file

@ -153,10 +153,14 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
public void newOutgoingCall(Intent intent) { public void newOutgoingCall(Intent intent) {
if (Intent.ACTION_CALL.equalsIgnoreCase(intent.getAction())) { String scheme = intent.getData().getScheme();
mAddress.setText(intent.getData().getSchemeSpecificPart()); if (scheme.startsWith("imto")) {
} else if (Intent.ACTION_SENDTO.equals(intent.getAction())) {
mAddress.setText("sip:" + intent.getData().getLastPathSegment()); mAddress.setText("sip:" + intent.getData().getLastPathSegment());
} else if (scheme.startsWith("call") || scheme.startsWith("sip")) {
mAddress.setText(intent.getData().getSchemeSpecificPart());
} else {
Log.e("Unknown scheme: ",scheme);
mAddress.setText(intent.getData().getSchemeSpecificPart());
} }
mAddress.clearDisplayedName(); mAddress.clearDisplayedName();

View file

@ -87,9 +87,10 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (!LinphoneManager.isInstanciated()) { if (!LinphoneManager.isInstanciated()) {
Log.e("No service running: avoid crash by finishing ", this.getClass().getName()); Log.e("No service running: avoid crash by starting the launcher", this.getClass().getName());
// super.onCreate called earlier // super.onCreate called earlier
finish(); finish();
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
return; return;
} }
instance = this; instance = this;