Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following needs to be done on Android Studio in Java. The code that needs to be written is regarding a simple GPS app on

The following needs to be done on Android Studio in Java. The code that needs to be written is regarding a simple GPS app on Android.

- Add the correct permission line in Android Manifest (either fine and coarse)

- Create an instance of the LocationManager class and assign it the value from a call to getSystemService. ( I started this and I think it is: LocationManager locationmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE )

- Create and register a LocationListener. ( I am pretty sure it is easiest to write implements LocationListenter on the main activity).

- Call the requestLocationUpdates method from the instance of LocationManager. The provider is LocationManager.GPS_PROVIDER.

- In the onLocationChanged method, use the Location parameter to display the latitude and longitude of your current location. ( I am pretty sure you can call the getLongitude() and getLatitude calls ) . To display the latitude and longitude, simply display this information in 2 textviews.

- Since a later version of Android is being used, to get this to work, there will be runtime permission which you have to get. (Pretty sure this can be done using if statements and overriding one method). You can simply check to see if permission has been granted and if it hasnt been granted, then ask for permission.

- Since the device/emulator running is Android 6.0 and higher with an SDK of 23 or higher, the app has to list the permissions in the manifest, and it must request each dangerous permission it needs while the app is running. The user can grant or deny each permission, and the app can continue to run with limited capabilities even if the user denies a permission request.

Please provide the working code of this along with any permissions that were added in the manifest.

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

15-5 How will MIS help my career?

Answered: 1 week ago