Force Close and Wait in GPS based application.

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Force Close and Wait in GPS based application.

Postby pranav09 » Sat Aug 07, 2010 6:57 am

Hi all,

I am developing a GPS based application in which i display a marker using latitude and longitude on map. I am not getting in correct location in google map whether i go to on My Location in map. When i run my application, it gives me Force Close and Wait dialog(It says that the application Tester is not responding). I am facing this message since from 5 days. I have T-Mobile-1.6 myTouch-3G. I also tried to update the map to get the correct location but it didn't take any effect.

Any idea? :?:

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Top

Re: Force Close and Wait in GPS based application.

Postby blundell » Sun Aug 08, 2010 6:39 pm

Read the LogCat about the force close. And show us.

Are you getting your location from GPS or the Network? If you dont know the answer to this i'd suggest you run over the Google Maps tutorial again:
http://developer.android.com/resources/ ... pview.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Mon Aug 09, 2010 6:34 am

Hi blundell,

Whenever i run any application, i always see the LogCat to see the running processes. Now, it's become my habit to see after running the application.

By the way, sometimes my phone doesn't give proper current location using Network Provider even the Google Map also doesn't give proper current location. But when i start GPS, it gives correct location. So, it's a little bit confuse to me. What to do? And for the LogCat, it shows me the number of usage % of CPU, and also i couldn't found any line related to my application. Now, what should i do? Please guide me.

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Re: Force Close and Wait in GPS based application.

Postby blundell » Mon Aug 09, 2010 8:17 am

Everything you need to know about LogCat is here:
http://developer.android.com/guide/deve ... tasks.html

You clearly haven't done Java before have you? Just get into the habit of reading all the LogCat and you'll soon get used to it.

The Network Provider has an accuracy of over 100metres or something large like that, check this post out:
http://www.listware.net/201007/android- ... ility.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby nuisanceValue » Mon Aug 09, 2010 10:42 am

I have found that my network provider position can be out by up to a couple of kilometres. So I wouldn't be too worried if you are getting the wrong position without GPS. As long as it is in the same area.
nuisanceValue
Freshman
Freshman
 
Posts: 7
Joined: Thu Jun 24, 2010 12:40 am

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Tue Aug 10, 2010 5:55 am

Yes blundell, i follow you. GPS accuracy is better than network provider accuracy. Is is true? Y'day i noticed that when i use GPS, the Force Close and Wait error is almost gone but when i use network provider it shows me many time.

So, what the difference to use it? Can you please clarify it? What should i use and what you recommend me?

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Top

Re: Force Close and Wait in GPS based application.

Postby blundell » Tue Aug 10, 2010 8:35 am

It's completely dependant on your application.

GPS takes longer to get a fix, GPS needs to be turned on to use it, GPS is very accurate,
Network Provider is less accurate, Network Provider uses less battery

your choice
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Tue Aug 10, 2010 8:59 am

I know, it's dependent on my application that whether i use network provider or GPS. Yesterday, i didn't get proper location using GPS when i was at my home. Sometimes, GPS is not giving proper current location in indoor. Is it true? If it is true, how much time it takes to fix it? Is there any approximate time or specific time?

It means that GPS uses more battery that network provider use. But for the accuracy, now i should use GPS.

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Re: Force Close and Wait in GPS based application.

Postby blundell » Tue Aug 10, 2010 9:30 am

GPS will take ages indoor as it needs it's signal from satellites that are in the sky!

You should code your app to get it's initial position from the Network then in the background update this using GPS. When the GPS takes longer than a certain amount say 40seconds get the network position again ( unless the GPS has changed the accuracy of the reading ). Thats just my preference anyway
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Tue Aug 10, 2010 9:43 am

Ok! I got you. :) So, can you guide me more with any example with code? It would be very easy way for me to understand it. Can you help me out?

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Re: Force Close and Wait in GPS based application.

Postby blundell » Tue Aug 10, 2010 9:57 am

Sorry I haven't got time to walk you through it, your best following google's examples:
http://developer.android.com/guide/topi ... index.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Tue Aug 10, 2010 10:11 am

It's OK.
By the way, in future, if you get, please don't forget to tell me. If i will have, i will sure post solution in particularly this post.

I will walk thorough it.

By the way, how to interpret with HOME key? Have you any idea?

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Re: Force Close and Wait in GPS based application.

Postby blundell » Tue Aug 10, 2010 10:15 am

Impossible, you cannot tell 100% on all devices when the home key is pressed. Nor would you want to override this behaviour.
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Force Close and Wait in GPS based application.

Postby pranav09 » Tue Aug 10, 2010 12:00 pm

I have put 2 override methods on MapActivity onPause() and onResume(). If the GPS is on through my app or it's already on, but when i press HOME key, GPS is not being pause whereas on the BACK key it's pause. For that i wrote code in onKeyDown(int keyCode, KeyEvent event). BACK key is working fine but HOME key doesn't take any effect. I have written code for BACK key as well as HOME key. So, now what can be the solution?

I have another question that, is it possible to enable GPS without start the activity of

Intent gpsIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(gpsIntent);

It means, i don't want to open this activity to enable GPS. It should directly enable it. Is it possible to do?

Thanks.
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Re: Force Close and Wait in GPS based application.

Postby blundell » Tue Aug 10, 2010 12:05 pm

I told you. You can't catch the home key. Use the activity Lifecycle.
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top
Next

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests