Commit ccbd5619 by 刘鹏

feat: 新增拨打电话方法call_telPhone

parent 5748b9b5
package com.ydl.js package com.ydl.js
import android.Manifest import android.Manifest
import android.content.Intent
import android.net.Uri
import com.blankj.utilcode.util.PermissionUtils import com.blankj.utilcode.util.PermissionUtils
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.google.gson.JsonParser import com.google.gson.JsonParser
...@@ -149,6 +151,14 @@ class JsMethod(private val webView: WebView?) { ...@@ -149,6 +151,14 @@ class JsMethod(private val webView: WebView?) {
) )
return true return true
} }
"call_telPhone" -> {
val phoneNumber = param.getAsJsonPrimitive("phonenumber").asString
phoneNumber?.let {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$phoneNumber"))
BaseActivityMgr.INST.topActivity?.startActivity(phoneIntent)
}
return true
}
else -> { else -> {
return false return false
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment