How do you do the following to develop an Android app?
-
1) When the app is started, it should check if GPS is enabled or not. If it is disabled, it should pop up asking user that, GPS has to be enabled in order to use the service? 2) When the app starts( and say if GPS is on), it should directly point to current location of the mobile phone. It should be zoomed as much as the Google maps allows. Please help me how to do these. Stackoverflow allows only to post questions with code.
-
Answer:
You're going to want to take a look here: http://developer.android.com/guide/topics/location/strategies.html The key part is that most of the GPS pop-up should be handled for you if you put the right permissions in the manifest. You're supposed to use the Google Maps v2 API when you have this GPS location, and I've included it below. Don't read much past "maintaining a current best estimate" as you can get what you ask for in the beginning. Ultimately these are the two lines of critical code you'll need to get working: String locationProvider = LocationManager.NETWORK_PROVIDER; // Or, use GPS location data: // String locationProvider = LocationManager.GPS_PROVIDER; locationManager.requestLocationUpdates(locationProvider, 0, 0, locationListener); And: Location lastKnownLocation = locationManager.getLastKnownLocation(locationProvider); As for a MapView, take a look at this document: https://developers.google.com/maps/documentation/android/ You want to power your map with this GPS data after you get it from the Location Manager. Good luck and happy coding!
Adam Schwem at Quora Visit the source
Other answers
Most of time, the most usefull imformation is the official API document! I am sure that in a addition to fix you problems,you can learn sth that more than you want. https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
Austen Chan
Related Q & A:
- How to connect Sql Server Database from android app?Best solution by Stack Overflow
- How much should I charge for an Android app in India?Best solution by Yahoo! Answers
- How to implement app purchase in Android app?Best solution by Stack Overflow
- How do I get the APK file for an Android app?Best solution by Yahoo! Answers
- How to connect Android app to App engine?Best solution by groups.google.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.