|
@@ -28,13 +28,16 @@ class MainActivity : ComponentActivity() {
|
|
|
private fun hassioRequest(webhookID: String) {
|
|
|
Thread {
|
|
|
try {
|
|
|
- var url = URL("URL_ADDRESS")
|
|
|
- var conn = url.openConnection() as HttpURLConnection
|
|
|
+ val url = URL("http://192.168.31.45:8123/api/webhook/$webhookID")
|
|
|
+ val conn = url.openConnection() as HttpURLConnection
|
|
|
conn.requestMethod = "GET"
|
|
|
conn.doInput = true
|
|
|
conn.doOutput = false
|
|
|
Log.i("MainActivity", "发送get请求:$webhookID" )
|
|
|
conn.connect()
|
|
|
+ val ret = conn.responseCode
|
|
|
+ Log.i("MainActivity", "发送 $webhookID 请求成功,返回码:$ret")
|
|
|
+ conn.disconnect()
|
|
|
}
|
|
|
catch (e: Exception) {
|
|
|
Log.i("MainActivity", "发送 $webhookID 请求失败")
|