Hick
Hick

Reputation: 36414

Error while showing map in an Android app of a user location derived from GPS

I'm generating Google map by using the code below. What I am doing here is just get the longitude/lat from GPS. The output I get is just black screen with Google written below. The key and manifest(also layout) are correct as I tried the same code by hardcoding lon/lat and it worked. What might be the error?

Upvotes: 0

Views: 149

Answers (2)

Brandon Wilson
Brandon Wilson

Reputation: 4600

You are using Location location = lm.getLastKnownLocation(strLocationProvider); Try launching an app with location. I had this same issue, you are getting a dead location. If this doesn't work then try logging you results with logcat. Find out if the you are actually getting a location or not.

Upvotes: 1

Zack Marrapese
Zack Marrapese

Reputation: 12091

Are you getting an NPE? You are checking if location is null, but then -- even if it is -- you are using it's methods.

Upvotes: 0

Related Questions