Handle also DIAL action

This commit is contained in:
Juha Heinanen
2023-05-02 14:35:16 +03:00
parent 5c5ada4d5c
commit 18f24380f4
2 changed files with 16 additions and 11 deletions

View File

@ -61,9 +61,9 @@
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
<data android:scheme="sip" />
<data android:scheme="sips" />
<data android:scheme="tel" />
</intent-filter>
</activity>
<activity

View File

@ -8,6 +8,7 @@ import android.app.KeyguardManager
import android.app.NotificationManager
import android.content.*
import android.content.Intent.ACTION_CALL
import android.content.Intent.ACTION_DIAL
import android.content.pm.PackageManager
import android.content.res.Configuration.ORIENTATION_PORTRAIT
import android.media.AudioManager
@ -652,7 +653,7 @@ class MainActivity : AppCompatActivity() {
atStartup = intent.hasExtra("onStartup")
if (intent?.action == ACTION_CALL) {
if (intent?.action == ACTION_CALL || intent?.action == ACTION_DIAL) {
if (BaresipService.isServiceRunning)
callAction(intent)
else
@ -823,15 +824,18 @@ class MainActivity : AppCompatActivity() {
resumeAction = ""
resumeUri = ""
if (intent.action == ACTION_CALL) {
Log.d(TAG, "onNewIntent $ACTION_CALL ${intent.data}")
callAction(intent)
} else {
val action = intent.getStringExtra("action")
Log.d(TAG, "onNewIntent action `$action'")
if (action != null) {
intent.removeExtra("action")
handleIntent(intent, action)
Log.d(TAG, "onNewIntent with intent.action '${intent.action}'")
when (intent.action) {
ACTION_DIAL, ACTION_CALL -> {
callAction(intent)
}
else -> {
val action = intent.getStringExtra("action")
if (action != null) {
intent.removeExtra("action")
handleIntent(intent, action)
}
}
}
}
@ -840,6 +844,7 @@ class MainActivity : AppCompatActivity() {
if (Call.inCall() || BaresipService.uas.size == 0)
return
val uri: Uri? = intent.data
Log.d(TAG, "callAction to $uri")
if (uri != null) {
when (uri.scheme) {
"sip" -> {