Get latitude and longitude on Android

Asked

Viewed 181 times

0

I’m creating an app on Android (with Android Studio) of Shopping. The idea is to register a purchase in the app that the user has performed. What I wanted is at the time we do that catch the latitude and longitude from where it is.

You asked what class and method I use for this on Android?

I mean Android 5, 6 up.

  • http://stackoverflow.com/a/2227299/3792998

  • Just remember, if the SDK you are using to compile is greater than API 23 (Android 6.0) you must enter the permissions at runtime, you can find details here

  • @Marcogiovanni on Android 6 all need to ask in Run Time? (permissions)

  • @Luizach Yes, but depending on your case you don’t need to use API 23 or higher to compile, if you compile with API 22 (Android 5.1.1), when your app is installed on android 6.0 or higher, the permissions will already be automatically enabled, this image demonstrates this

  • @Luizach I published an answer here on the question: "The location obtained by getLastLocation() always returns null", which will be useful to you.

  • best starting point is always the documentation

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.