简体   繁体   中英

Open weather Map android Location manager

I have tried to implement the openweather map api following the android tutorial. Which only shows default hard coded city and providing user city preferences. But my intention is to parse the api based on Location/ gps services provided by android permissions.

Kindly please help me with code to request weather result based on current location of the user.

The main permissions you need are android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION.

Only fine location will allow you access to gps data, and allows you access to everything else coarse location gives. You can use the methods of the LocationManager to acquire location data from gps and cell tower sources already,so no need to work out this information yourself.

Android Manifest Permissions: http://developer.android.com/reference/android/Manifest.permission.html

You can get this permission and find the location which can be used in weather api.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM