diff --git a/android/app/build.gradle b/android/app/build.gradle
index c015307..cf67e9b 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -37,6 +37,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
+ implementation "com.google.android.gms:play-services-location:17.0.0"
implementation 'androidx.preference:preference:1.1.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 88c9093..f4a3ae1 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -3,6 +3,10 @@
package="de.hft.geotracker">
+
+
+
+
(R.id.latitude).text = location.latitude.toString()
+ findViewById(R.id.longitude).text = location.longitude.toString()
+ findViewById(R.id.altitude).text = location.altitude.toString()
+ }
+ }
+ }
// val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
// val navController = this.findNavController(R.id.HostFragment)
// NavigationUI.setupActionBarWithNavController(this, navController)
@@ -49,8 +79,43 @@ class MainActivity : AppCompatActivity() {
// Apply the adapter to the spinner
spinner.adapter = adapter
}
+ actionButton = findViewById(R.id.button_start_stop)
+ actionButton.setOnClickListener {
+ callStartStop()
+ }
}
+ private fun callStartStop() {
+ println("StartStop pressed")
+ fusedLocationClient.lastLocation
+ .addOnSuccessListener { location : Location? ->
+ if (location != null) {
+ var label = findViewById(R.id.display_acc)
+ label.text = location.latitude.toString()
+
+ } else {
+ println("Location = null")
+ }
+ }
+ }
+
+ override fun onResume() {
+ super.onResume()
+ startLocationUpdates()
+ }
+
+ private fun startLocationUpdates() {
+ fusedLocationClient.requestLocationUpdates(locationRequest,
+ locationCallback,
+ Looper.getMainLooper())
+ }
+ fun createLocationRequest() {
+ locationRequest = LocationRequest.create().apply {
+ interval = 10000
+ fastestInterval = 5000
+ priority = LocationRequest.PRIORITY_HIGH_ACCURACY
+ }
+ }
override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
R.id.settings -> {
// User chose the "Settings" item, show the app settings UI...
diff --git a/android/app/src/main/res/layout/activity_home.xml b/android/app/src/main/res/layout/activity_home.xml
index f74b28f..53b5411 100644
--- a/android/app/src/main/res/layout/activity_home.xml
+++ b/android/app/src/main/res/layout/activity_home.xml
@@ -83,9 +83,42 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar" />
+
+
-
+
\ No newline at end of file