I am developing an Android app with Phonegap. I'm using Phonegap geolocation and get lat and long from it. How I can get a GPRMC statement?
There is no built-in function for doing so. You can use the NMEA Sentence Definition and other NMEA references to encode the positional information you receive from PhoneGap and produce a GPRMC-encoded string.
As you likely discovered, there will be items you cannot reliably change to a GPRMC sentence with high accuracy due to device limitations (you never know if they feature a compass heading, for instance).
Related
I'm making an android app that connects to an OBD-II device (ELM327 - http://www.dx.com/p/elm327-bluetooth-odb2-v1-5-car-diagnostic-interface-126921#.V86wdih97IU) via Bluetooth.
I'm also using the https://github.com/pires/obd-java-api/ library to get the data from the device.
I am able to connect to the device and get data without any problems but when I try to retrieve distance it always returns it in KM. Is there a way to get the distance of a trip in meters instead?
I tried using the Torque Lite app (https://play.google.com/store/apps/details?id=org.prowl.torquefree&hl=en) and its able to return Trip distance in KM with one decimal place (0.0 KM).
Would like to know what command it uses to actually get the values or does it derive it from something else.
Unfortunately, a standard PID for distance traveled simply doesn't exist. See this for a list of standard PIDs.
The code you are using now, DistanceSinceCCCommand, uses standard Mode 01 PID 0x31 to retrieve the distance driven since the last clear codes command. The PID has units of integer kilometers and thus cannot give you the precision you are seeking.
I tried using the Torque Lite app (https://play.google.com/store/apps/details?id=org.prowl.torquefree&hl=en) and its able to return Trip distance in KM with one decimal place (0.0 KM).
The torque app used location(GPS) information from the android device to record geo location. I'd guess that it is using that information to determine the trip distance to the precision of 0.1km.
Recommendation
I'd recommend you follow their lead and use location data to determine distance traveled if you need that sort of accuracy.
Use a Location Listener from the google location api and Location.distanceTo(location) to determine the incremental location changes.
More On Enhanced PIDs
Enhanced PIDs (also called DIDs) are mode 22 parameters that are vehicle specific.
There exist many other vehicle parameters that are not publicly documented and may offer better precision. They are vehicle specific (but usually common to a subset of vehicles from the same manufacturer). They are Mode 22 enhanced PIDs. Here's a list of old Ford DIDs. If anyone can find a newer list of mode 22 DIDs, please edit my post and add it as I know there are many more than I've found available publicly.
GM Chevy Spark PIDs
You could read the OBD-II Mode 1, PID 0D to get the speed at regular intervals. This would give a decent distance reading in metres if you read often enough and apply the distance = speed * time calculation.
Most of the classes implement
ObdCommand
which has a method
useImperialUnits(boolean)
so, if you use, say, DistanceSinceCCCommand, then
DistanceSinceCCCommand distanceSinceCCCommand = new DistanceSinceCCCommand();
distanceSinceCCCommand.useImperialUnits(true);
would do the conversion.
You can find interesting stuff if you examine the library source.
You can also use
getImperialUnit()
if you just want the numeric value rather than the string with a trailing units label.
I need to get real GPS time from GPS module on Android device. My app realizes nmeaListener and i receive some raw NMEA packets with onNmeaReceived() callback. Threre is one string in NMEA protocol, that contains data and time - $GPZDA. But my callback doesn't give it ti me. There are all other string except this one.
Is there some way to ask GPS module bring it to mee with Android SDK tools? Or any other ways?
You overlooked the date. $GPRMC,075239.00,A,5538.533544,N,03728.327837,E,0.0,0.0,171215,8.8,W,A*23
171215 is 17-12-2015.
Today ;-)
I am writing my Master thesis atm and analyzed about 400 different GPS-Trajectories (paths consisting of a list of longitude/latitude points and an according timestamp) recorded with the MediaQ-App (probably not important) for Android (about 310 trajectories) and iOS (about 90).
When analyzing the time intervals between the timestamps, I was expecting the inaccuracies around the 1 second frequency, in which the timestamps were supposed to be recorded, since neither Android or iOs are real-Time-OS from apps point of view. Still, why are there, what appears to be local peaks in about 200ms steps? Be nice, I do not know a lot about mobile operating systems :-)
(x-axis: seconds, y-axis: the relative probability that a timestamp will be recorded at this point in time. Ignore the exact values of the y-axis...)
The usual behavior is that an App takes the timestamp direct from the location delivered by the system. Most probably this is the case in that App, otheriwse this would be a heavy programming bug. (The delay between nominal GPS time and receiving system time of about 200ms is plausible, I saw that in my app, and in ios Map app, which makes a correction in their map api to extrapolate the location into the future, to try to compensate that delay)
Under android (and ios) it is import to know whether the location are determined exclusively by GPS. On both plattforms (ios, android) an App can set whether GPS only or combined GPS + WLAN + Cell Locationing is used.
For high quality recording is is highly recomended to use GPS only.
A GPS chip once having a location usually outputs a location with a timestamp exactly at 000. Exception can happen before the location is valid.
Under ios if the location was obtained by GPS the millisecond are always 0.
I have no experience with android, but usually the GPS chip itself sets the value to millis = 0. (However, some android phones are known to use a crippled cheap GPS chips, that are not able to get an intial position without the help of an internet conection)
It is possible to determine whether the location was obtained by GPS by looking at the course (or called heading) and speed value, which are invalid for non GPS locations (cell Tower locationing)
To know whether this time variations come from the Application (not using the GPS only mode) or if it is caused by Android, you can test that with another application on the same phone. (E.g Motion-X GPS) (Or by comparing both apps on another android phone)
So I know next to nothing about GPS and Apps, but I do want to get my feet wet and have a (simple-ish in my mind) idea for a simple app based on GPS or manual address.
I basically need to know if you can do something like this
if GPS Location is (11.111/22.222) { Show(**THIS STUFF**) }
or if manual address is (555 Main St, Salem, OR) { Show(**THIS STUFF**)}
in android or iphone
You can. It's considerably more complex than that. And there are apps for both platforms that do exactly that. A quick search of Google, Apple Store, and Android Market will tell you what the current apps for that are.
If you want to do this yourself you will need to learn some new concepts. Geofencing (geographic buffers). Geolocation (address to coordinate conversion). And read up on how to efficiently use the location services provided by the devices you are writing for.
You should use android location api for GPS Location, and check in the onLocationChanged() method : if(myLocation.getLatitude==11.111 && mylocation.getLongitude==22.222)
On manual adress You should use android maps api.
Can the longitude, latitude, and altitude of the sender of an SMS be ascertained in code?
Not unless you have some way of pinging the sender's phone - an sms is basically two parts: the message itself, and the phone number of the sender. There's no location data included with it, and definiteley no gps coordinates.
Of course not; for a start, most mobile phones don't have GPS receivers.
Although there appears to be limited information on the topic, you should look into Silent SMS. It does not appear to be what you are asking but it's an interesting topic. There appear to be reports that these messages can be used by a telcom to obtain positional details.
You can easily encode all those coordinates in an SMS but they are not there by default. First, SMS'es' were developed at a time when we didn't have smart phones. Second, it would be a terrible privacy issue if you could.