._.
This commit is contained in:
parent
7454461e84
commit
13429ca61d
@ -333,7 +333,7 @@ def get_events():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
init_db()
|
init_db()
|
||||||
app.run()
|
app.run('0.0.0.0')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
31
Mobile/app/src/main/java/com/example/russionroadsapp/API.kt
Normal file
31
Mobile/app/src/main/java/com/example/russionroadsapp/API.kt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package com.example.russionroadsapp
|
||||||
|
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.io.BufferedReader
|
||||||
|
import java.io.InputStreamReader
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
|
object API {
|
||||||
|
private val API_BASE_URL = "http://192.168.0.124:5000"
|
||||||
|
|
||||||
|
fun getNews(onFinish: (String) -> Unit) {
|
||||||
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
|
val reqURL = URL("$API_BASE_URL/rss")
|
||||||
|
val connection = reqURL.openConnection() as HttpURLConnection
|
||||||
|
connection.requestMethod = "GET"
|
||||||
|
|
||||||
|
if (connection.responseCode == 200) {
|
||||||
|
val resp = BufferedReader(
|
||||||
|
InputStreamReader(connection.inputStream)
|
||||||
|
).use { it.readText() }
|
||||||
|
|
||||||
|
onFinish(resp)
|
||||||
|
} else {
|
||||||
|
onFinish("Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
MyApplication/app/src/main/AndroidManifest.xml
Normal file
27
MyApplication/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.MyApplication"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.MyApplication">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
Loading…
x
Reference in New Issue
Block a user