0

i did the GPS application which gets the current location.It is working in android emulator by using DDMS perspective(by passing mock location).But it is not working in android phone and phone is Samsung gt-i5801.please help me. And one more thing i want to ask you guys. (Why i need Gps) bcoz in my appln i want to display the nearest cinema theatres by using latitude and longitude. Is there any other way to do that. Please tell me.

0

2 Answers 2

1

I think there is no problem in your code if it runs in emulator. But you have not start the gps on your phone, so it's giving a null pointer exception.

So now when you use gps, first check whether gps is on or not. Then fetch lat. and long.

You can check your gps is on or off by this:

LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

boolean val= mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
1
  • yes chirag i enabled the GPS then also it is not giving me the location.But how can i check GPS is working or not in handset.Please reply.
    – VK.Dev
    Jan 20, 2011 at 7:29
0

First of all, tell us what errors are you getting when you run it on the device. Logcat messages!?

Secondly, there must be any webservice which gives you the nearby cinema theatres, so you might be required to give it your current location in latitude and longitude.

For getting your current location, GPS is necessary.

On the other note, you can also use NETWORK_PROVIDER to get your current location.

6
  • it is not giving error.But how can i check GPS is working or not in handset.Please reply.
    – VK.Dev
    Jan 20, 2011 at 7:28
  • Normally all handsets give a sign of GPS activity in the notification area,you can see if ur device has a blinking satellite sign when you try to get location. which method are you using? NETWORK_PROVIDER or GPS one?
    – Aman Alam
    Jan 20, 2011 at 9:33
  • I am using GPS.It is showing blinking satelite but is not showing any values.I think OnLocationChanged event is not raising.Is there any way to raise that event manually.
    – VK.Dev
    Jan 21, 2011 at 6:13
  • No. I don't think so. maybe satellites aren't available in the area ur testing!
    – Aman Alam
    Jan 21, 2011 at 6:26
  • its ok.forget this issue.it is working by network provider.now my doubt is my main menu has more than 40 items.So i want to show that in two screens like home screens in android.So how can i do that.Please reply with example.
    – VK.Dev
    Jan 21, 2011 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.