Answered step by step
Verified Expert Solution
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.osBundle
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.materialButton
import androidx.compose.materialScaffold
import androidx.compose.materialText
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.uiAlignment
import androidx.compose.uiModifier
import edu.metrostate.labuitheme.LabTheme
In this lab you will get the location of the mobile
device and display the latitude and longitude.
When the "Get Location" button is tapped, check for
the location permission.
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.
If the location permission is given, proceed to getting the location.
Use the location provider to get the location.
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 dropbox on DL
class MainActivity : ComponentActivity
override fun onCreatesavedInstanceState: Bundle?
super.onCreatesavedInstanceState
enableEdgeToEdge
setContent
LabTheme
val location by remember mutableStateOf
Scaffoldmodifier Modifier.fillMaxSize innerPadding
Column
modifier Modifier.paddinginnerPadding
verticalArrangement Arrangement.Center,
horizontalAlignment Alignment.CenterHorizontally,
Text
text location
ButtononClick
TextGet Location"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started