diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8f87ec6..5cd76b5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
+
diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
index 5764a08..a25456d 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt
@@ -60,6 +60,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
private val appMenuLinearLayoutManager = AppMenuLinearLayoutManager(this@MainActivity)
private val appMenuEdgeFactory = AppMenuEdgeFactory(this@MainActivity)
private val animations = Animations()
+ private val weatherSystem = WeatherSystem()
private val swipeThreshold = 100
private val swipeVelocityThreshold = 100
@@ -149,7 +150,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
val statusBarManager: Class<*> = Class.forName("android.app.StatusBarManager")
val expandMethod: Method = statusBarManager.getMethod("expandNotificationsPanel")
expandMethod.invoke(statusBarService)
-
+ weatherSystem.getWeather()
}
// Detect swipe left
diff --git a/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt b/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
index 8d8e316..e96a801 100644
--- a/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
+++ b/app/src/main/java/eu/ottop/yamlauncher/WeatherSystem.kt
@@ -1,4 +1,31 @@
package eu.ottop.yamlauncher
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+import org.json.JSONObject
+import java.net.HttpURLConnection
+import java.net.URL
+
class WeatherSystem {
+ fun getWeather() {
+ CoroutineScope(Dispatchers.IO).launch {
+ val url = URL("https://api.open-meteo.com/v1/forecast?latitude=60.16&longitude=24.93¤t=temperature_2m")
+ with(url.openConnection() as HttpURLConnection) {
+ requestMethod = "GET"
+
+ inputStream.bufferedReader().use {
+ val response = it.readText()
+
+ // Parse the JSON response
+ val jsonObject = JSONObject(response)
+
+ // Access specific fields or nested objects
+ val currentData = jsonObject.getJSONObject("current")
+ val currentWeather = currentData.getInt("temperature_2m")
+
+ println("Field1: $currentWeather")
+ }
+ }}
+ }
}
\ No newline at end of file