I'm intelligence with Android localization and already have figured out that Anmia data on how to receive. Unfortunately, the result seems very chaotic. I only need the punishment of GPRMC, but I get GPGG, GPVTG etc. There is no way of controlling onNmeaReceived () function
public class TrackingService extends Service {private means broadcastIntent = new Intent ( "com.example.locationlogger.TestBroadcastReceiver"); Personal Location Manager LM; Private placelister ll = new location -lister () {// sample listener ...}; GpsStatus.NmeaListener nl = new GpsStatus.NmeaListener () {@Override public void onNmeaReceived (long timestamp, string NMEA) {Send / * B .. * / broadcastIntent.putExtra ( "TESTVAR", "receive NMEA strings:" + Nemia); SendBroadcast (broadcastIntent); }}; @reverride Public Zero Create () {lm = (LocationManager) getSystemService (context.LOCATION_SERVICE); } @Override public void OnStart (Intent intent, int startId) {lm.requestLocationUpdates (LocationManager.GPS_PROVIDER, interval * 1000, 0, LL); Lm.addNmeaListener (nl); } }
Thank you for your reply - all valid Points. Acutally I used to solve it with a regex pattern and filter matcher.find () appropriate sentence. In my case, it was a GPRMC sentence and only if valid data was included in it here is the Java regex string - Maybe someone can use it again
public static pattern P = Pattern.compile ("(\\ $ GPRMC) \\, ((\\ d {6}) \\ .? \\ d *) \\, ([AVI] {1}) \\, (\\ d * \\.? \\ d *) \\, ([ns] {1}) \\ , (\\ d * \\.? \\ d *) \\, ([EW] {1}) \\, ([0-9] * \\. [[0-9] *) \ \, ([0-9] * \\.? [0-9] *) \\, ([0-9] {6}) \\, ([0-9] * \\. [[0- 9] *) \\, ([EW]) \\, ([ADEMSN] {1} * [0-9A-F] {2}) ")? .. To see how I classified regex, use this regex string
(\ $ GPRMC) \, ((\ d {6}). ? \ D *) \, ([A V] {1}), \ \ (\ d *.? \ D *) \, ([ns] {1}) \, (\ d *.? \ D * ) \, ([EW] {1}), ([0-9] .? [0-9] ), ([0-9] .? [0- 9] ) \, ([0-9] {6}) \, ([0-9] .? [0-9] ) \, ([EW]?) \, ([ADEMSN] {1}. *. [0- 9 a-F] {2})
this Anmia $ GPRMC, 090,248, a, 4745.012742, N, 01,304.143827, e, 0.0,0.0,310710,5.3, e, a * 48 Regards, Martin
Comments
Post a Comment