Mock LocationProvider - Structure/Explanation (NMEA, $GPRMC)

Tutorials that use the MapActivity. Many using GPS functionality.

Postby plusminus » Sun Mar 09, 2008 12:47 pm

Hello zoe,

did you also try pushing the file via console/terminal :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

still not working..!!!

Postby zoe11 » Sun Mar 09, 2008 5:35 pm

yes, i already do that too but i always failed to push the $GPRMC?!?
I already succeded to push the nmea($GPRMC for jakarta route) file into emulator via adb but the ME location always point somewhere around india and not jakarta despite how many times i restart the emulator.....
zoe11
Freshman
Freshman
 
Posts: 5
Joined: Mon Feb 25, 2008 7:26 am
Location: Indonesia

Postby plusminus » Mon Mar 10, 2008 12:18 am

Hello zoe,

so it almost worked ;)
Its sounds like you have an error in your GPRMC-route, as the "result" is pretty close.

I attached a working KML-route for Germany. (From "Schriesheim" to "Dossenheim").
Give it a try.

Regards,
plusmunus
Attachments
kml.zip
KML-Route Germany (Schriesheim to Dossenheim)
(2.04 KiB) Downloaded 583 times
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Your GPRMC checksum doesn't work, try this one

Postby rawad00 » Tue Apr 15, 2008 9:58 am

Your GPRMC checksum doesn't work, try this one
Try it , and compare the results....with the one you gave and the $GPRMC sentence examples you gave...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public String checkSum(String sentence){
  2.        //Sentence between $ and *
  3.         String message = (String) sentence.subSequence(sentence.indexOf('$')+1, sentence.indexOf('*'));
  4.          
  5.             int checksum = 0;
  6.             for(int i = 0; i < message.length(); i++){
  7.  
  8.                 checksum ^= (byte) message.charAt(i);
  9.             }
  10.  
  11.             return Integer.toHexString(checksum).toUpperCase();
  12.  
  13.     }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
!! R@w@d !!
rawad00
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Feb 22, 2008 4:28 pm
Location: France

Postby nithin.warier » Mon May 05, 2008 5:55 am

hi plusminus,
i am creating a mock location provider for Chennai (India). I created few sentences in nmea file, the locations file and properties file. But i came across one problem .

1. In the getCheckSum(String sentence) function, how can we get the sentence.
2. using push, shall we can push the folder(test1) to eclipse.

please reply immeadiately,

Thanks
Nithin
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Postby plusminus » Tue May 06, 2008 8:41 pm

Hello nithin.warier,

I strongly suggest using kml :!:

If you choose kml its a job of minutes :!:
You'll find info on how to set up a route using kml here on anddev.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby nithin.warier » Wed May 07, 2008 5:03 am

Thanks plusminus,

i used kml file and its working..

thank you very much, anddev is helping me a lot..
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Postby plusminus » Wed May 07, 2008 7:43 pm

nithin.warier wrote:Thanks plusminus,

i used kml file and its working..

thank you very much, anddev is helping me a lot..


Thats always nice to hear :)
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby aziziti » Thu May 07, 2009 6:14 pm

Hi everyone, I am using the new 1.5 SDK and I am trying to extract NMEA files but I failed:
I tried to do this:

Code: Select all
C:AndroidSDKtools>adb pull data/misc/location/gps/nmea C:Android


and I got this error:
remote object 'data/misc/location/gps/nmea' does not exist

I am thinking that there is no such folder location.

Please Help me!
aziziti
Freshman
Freshman
 
Posts: 8
Joined: Mon Apr 27, 2009 4:30 pm

Postby Leonard » Tue Jun 02, 2009 1:48 pm

@aziziti: that method is indeed obsolete since SDK 1.5 Check out the location dev guide.

@all: I tried out plusminus's KML route in Germany. When I try to play it in DDMS, an icon shows up at the inital point but never moves, and after a while it simply disappears. Pressing play again doesn't help at all. I was following the tutorial from Andreas Frey's blog. Also, when I'm sending single GPS fixes, it works for 2 or 3 times n then just stops doing anything...I find this behaviour pretty strange.

EDIT: OK, so I did some debugging on the matter: I can only provide a location twice, either through DDMS or telnet. The onStatusChanged method returns gps as available. The icon shows up when I send the first location, moves when I send the second location. When I send a location for the third time, nothing happens. The onLocationChanged method isn’t called, neither are any other locationListener methods - gps isn’t reported to be unavailable or anything. MapActivity reports an error as soon as our Activity is started, saying “Couldn’t get connection factory client”.

Andreas's code works fine because it behaved like expected when I provided fake location coordinates from a simple array.
Any ideas what this might be???
Leonard
Freshman
Freshman
 
Posts: 6
Joined: Mon May 18, 2009 1:50 pm
Location: Munich, DE

about mock location provier

Postby midou55 » Tue Jan 12, 2010 11:20 am

Hello, i have cread a location provider that reads kml files and sends points , this works fine. so i can generate paths as i want and inject them inside sdcard.
Now the probelm is that when testing on real device i get the error below :

01-12 11:00:35.280: ERROR/AndroidRuntime(717): Caused by: java.lang.SecurityException: Requires ACCESS_MOCK_LOCATION secure setting

any idea
midou55
Freshman
Freshman
 
Posts: 3
Joined: Wed Nov 18, 2009 1:41 pm

Postby fkizewski » Mon Feb 22, 2010 4:14 pm

Hi all,

I've added this at the end of the function in JAVA
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. String toReturn = Integer.toHexString(checksum);
  2. if(toReturn.length() < 2)
  3.         toReturn = "0" + toReturn;
  4. // Return the checksum formatted as a two-character hexadecimal
  5. return toReturn.toUpperCase();
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Because before i've a cheksum : *e than *0E (that's better for me) - Example : $GPRMC,173725.000,A,5022.1274,N,304.5536,N,0.485963,311.1328,180210,,*0E

By
User avatar
fkizewski
Freshman
Freshman
 
Posts: 3
Joined: Wed Dec 16, 2009 2:49 pm
Location: France

Re: Mock LocationProvider - Structure/Explanation (NMEA, $GP

Postby yorammizrachi » Mon Jun 07, 2010 4:18 am

Greetings,

Does anyone know how can I use mock location on real handset (not emulator)?
Can I create something which is not "coded" into the application so any GPS-based application see this mock location?

thanks
yorammizrachi
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jun 07, 2010 4:12 am

Re: Mock LocationProvider - Structure/Explanation (NMEA, $GP

Postby adameve24 » Tue Dec 28, 2010 8:31 pm

but there is no such folder named "location" in misc.
i created a location folder and a gps folder in it.
but nothing happened.
adameve24
Developer
Developer
 
Posts: 29
Joined: Wed Dec 15, 2010 12:32 pm

Top
Previous

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest