Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Its Andriod Studio! I already put the Manifestxml just do the requirement and make sure after you run the code in the device it shows

Its Andriod Studio! I already put the Manifestxml just do the requirement and make sure after you run the code in the device it shows the Lagitute and the langitute and show me how i can put mine!
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import edu.metrostate.lab7.ui.theme.Lab7Theme
/**
* In this lab you will get the location of the mobile
* device and display the latitude and longitude.
*
*1. When the "Get Location" button is tapped, check for
* the location permission.
*2. If the location permission is not given, ask for the location permission.
* a. If the permission is denied change the text in the Text to tell the user
* the permission has been denied.
* b. If the permission is granted, proceed to getting the location.
*3. If the location permission is given, proceed to getting the location.
*4. Use the location provider to get the location.
*5. Display the latitude and longitude from the Location object returned
* by location provider.
*
* Once you have completed the above steps, zip the project folder and
* submit to the Lab 7 dropbox on D2L.
*/
class MainActivity : ComponentActivity(){
override fun onCreate(savedInstanceState: Bundle?){
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
Lab7Theme {
val location by remember { mutableStateOf("")}
Scaffold(modifier = Modifier.fillMaxSize()){ innerPadding ->
Column(
modifier = Modifier.padding(innerPadding),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
){
Text(
text = location
)
Button(onClick ={}){
Text("Get Location")
}
}
}
}
}
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

How can the Internet be helpful in a job search? (Objective 2)

Answered: 1 week ago