@@ -191,31 +191,46 @@ class LocationAPIListener implements LocationListener {
191
191
192
192
public void locationUpdated (LocationProvider provider , Location location ) {
193
193
// определение кол-ва спутников
194
- String nmea = location .getExtraInfo ("application/X-jsr179-location-nmea" );
195
- if (nmea != null ) {
196
- String [] sequence = split (nmea , '$' );
197
- int s1 = -1 ;
198
- int s2 = -1 ;
199
- for (int i = sequence .length - 1 ; i >= 0 ; i --) {
200
- String [] sentence = split (sequence [i ], ',' );
201
- if (sentence [0 ].endsWith ("GGA" )) {
202
- try {
203
- s1 = Integer .parseInt (sentence [7 ]);
204
- } catch (Exception e ) {
205
- s1 = -1 ;
206
- }
207
- s2 = Math .max (s2 , s1 );
208
- } else if (sentence [0 ].endsWith ("GSV" )) {
209
- try {
210
- s2 = Math .max (s2 , Integer .parseInt (sentence [3 ]));
211
- } catch (Exception e ) {
194
+ satellites : {
195
+ // парамы из патча для symbian^3 https://github.com/shinovon/Symbian3JSR179Mod
196
+ try {
197
+ String s1 = location .getExtraInfo ("satelliteNumInView" );
198
+ String s2 = location .getExtraInfo ("satelliteNumUsed" );
199
+ if (s1 != null && s2 != null ) {
200
+ totalSattelitesInView = Integer .parseInt (s1 );
201
+ sattelites = Integer .parseInt (s2 );
202
+ break satellites ;
203
+ }
204
+ } catch (Exception e ) {}
205
+ // парс сырых nmea данных
206
+ String nmea = location .getExtraInfo ("application/X-jsr179-location-nmea" );
207
+ if (nmea != null ) {
208
+ String [] sequence = split (nmea , '$' );
209
+ int s1 = -1 ;
210
+ int s2 = -1 ;
211
+ for (int i = sequence .length - 1 ; i >= 0 ; i --) {
212
+ String s = sequence [i ];
213
+ if (s .indexOf ('*' ) != -1 ) s = s .substring (0 , s .lastIndexOf ('*' ));
214
+ String [] sentence = split (s , ',' );
215
+ if (sentence [0 ].endsWith ("GGA" )) {
216
+ try {
217
+ s1 = Integer .parseInt (sentence [7 ]);
218
+ } catch (Exception e ) {
219
+ s1 = -1 ;
220
+ }
221
+ s2 = Math .max (s2 , s1 );
222
+ } else if (sentence [0 ].endsWith ("GSV" )) {
223
+ try {
224
+ s2 = Math .max (s2 , Integer .parseInt (sentence [3 ]));
225
+ } catch (Exception e ) {
226
+ }
212
227
}
213
228
}
229
+ sattelites = s1 ;
230
+ totalSattelitesInView = s2 ;
231
+ } else {
232
+ totalSattelitesInView = sattelites = -1 ;
214
233
}
215
- sattelites = s1 ;
216
- totalSattelitesInView = s2 ;
217
- } else {
218
- totalSattelitesInView = sattelites = -1 ;
219
234
}
220
235
String s = "" ;
221
236
int t = location .getLocationMethod ();
@@ -263,7 +278,7 @@ public void locationUpdated(LocationProvider provider, Location location) {
263
278
positionPoint .lon = coordinates .getLongitude ();
264
279
positionPoint .color = Geopoint .COLOR_RED ;
265
280
state = STATE_OK ;
266
- lastUpdateTime = System . currentTimeMillis ();
281
+ lastUpdateTime = location . getTimestamp ();
267
282
MahoMapsApp .GetCanvas ().requestRepaint ();
268
283
} else {
269
284
state = STATE_UNAVAILABLE ;
0 commit comments