Handle also DIAL action
This commit is contained in:
@@ -61,9 +61,9 @@
|
|||||||
<action android:name="android.intent.action.CALL" />
|
<action android:name="android.intent.action.CALL" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="tel" />
|
||||||
<data android:scheme="sip" />
|
<data android:scheme="sip" />
|
||||||
<data android:scheme="sips" />
|
<data android:scheme="sips" />
|
||||||
<data android:scheme="tel" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.app.KeyguardManager
|
|||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.content.Intent.ACTION_CALL
|
import android.content.Intent.ACTION_CALL
|
||||||
|
import android.content.Intent.ACTION_DIAL
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Configuration.ORIENTATION_PORTRAIT
|
import android.content.res.Configuration.ORIENTATION_PORTRAIT
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
@@ -652,7 +653,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
atStartup = intent.hasExtra("onStartup")
|
atStartup = intent.hasExtra("onStartup")
|
||||||
|
|
||||||
if (intent?.action == ACTION_CALL) {
|
if (intent?.action == ACTION_CALL || intent?.action == ACTION_DIAL) {
|
||||||
if (BaresipService.isServiceRunning)
|
if (BaresipService.isServiceRunning)
|
||||||
callAction(intent)
|
callAction(intent)
|
||||||
else
|
else
|
||||||
@@ -823,23 +824,27 @@ class MainActivity : AppCompatActivity() {
|
|||||||
resumeAction = ""
|
resumeAction = ""
|
||||||
resumeUri = ""
|
resumeUri = ""
|
||||||
|
|
||||||
if (intent.action == ACTION_CALL) {
|
Log.d(TAG, "onNewIntent with intent.action '${intent.action}'")
|
||||||
Log.d(TAG, "onNewIntent $ACTION_CALL ${intent.data}")
|
|
||||||
|
when (intent.action) {
|
||||||
|
ACTION_DIAL, ACTION_CALL -> {
|
||||||
callAction(intent)
|
callAction(intent)
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
val action = intent.getStringExtra("action")
|
val action = intent.getStringExtra("action")
|
||||||
Log.d(TAG, "onNewIntent action `$action'")
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
intent.removeExtra("action")
|
intent.removeExtra("action")
|
||||||
handleIntent(intent, action)
|
handleIntent(intent, action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun callAction(intent: Intent) {
|
private fun callAction(intent: Intent) {
|
||||||
if (Call.inCall() || BaresipService.uas.size == 0)
|
if (Call.inCall() || BaresipService.uas.size == 0)
|
||||||
return
|
return
|
||||||
val uri: Uri? = intent.data
|
val uri: Uri? = intent.data
|
||||||
|
Log.d(TAG, "callAction to $uri")
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
when (uri.scheme) {
|
when (uri.scheme) {
|
||||||
"sip" -> {
|
"sip" -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user