Skip to content

Commit 3d6798c

Browse files
author
Antonis
committed
Fixed #692: Improve intent handling so that external URLs work better
1 parent edc226c commit 3d6798c

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Examples/restcomm-olympus/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</intent-filter>
4646
<intent-filter>
4747
<action android:name="android.intent.action.CALL"/>
48-
48+
<action android:name="android.intent.action.VIEW" />
49+
<action android:name="android.intent.action.DIAL" />
4950
<category android:name="android.intent.category.DEFAULT"/>
5051
<category android:name="android.intent.category.BROWSABLE"/>
5152

Examples/restcomm-olympus/app/src/main/java/org/restcomm/android/olympus/SigninActivity.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ protected void onCreate(Bundle savedInstanceState)
7373
//boolean signedUp = prefsGeneral.getBoolean(PREFS_SIGNED_UP_KEY, false);
7474

7575
// see if we are called from an external App trying to make a call
76-
if (getIntent().getAction().equals(Intent.ACTION_CALL) && getIntent().getData() != null) {
77-
if (getIntent().getData() != null) {
78-
// note down the fact that we are signed up so that
79-
//SharedPreferences.Editor prefEdit = prefsGeneral.edit();
80-
//prefEdit.putString(PREFS_EXTERNAL_CALL_URI, getIntent().getData().getHost());
81-
//prefEdit.apply();
82-
globalPreferences.setExternalCallUri(getIntent().getData().toString());
83-
}
76+
// Notice that we also add the ACTION_VIEW, so that it also works for
77+
// numbers inside text that we tap on for example in default Android SMS App.
78+
// For the ACTION_VIEW, the number comes prepended with tel, like 'tel:XXXXXXXXX'
79+
if ((getIntent().getAction().equals(Intent.ACTION_CALL) || getIntent().getAction().equals(Intent.ACTION_VIEW)) &&
80+
getIntent().getData() != null) {
81+
// note down the fact that we are signed up so that
82+
//SharedPreferences.Editor prefEdit = prefsGeneral.edit();
83+
//prefEdit.putString(PREFS_EXTERNAL_CALL_URI, getIntent().getData().getHost());
84+
//prefEdit.apply();
85+
globalPreferences.setExternalCallUri(getIntent().getData().toString());
8486
}
8587

8688
if (globalPreferences.haveSignedUp()) {

0 commit comments

Comments
 (0)