Hi, And you are missing the NMEA callback method - onNmeaReceived<http://developer.android.com/reference/android/location/GpsStatus.NmeaListener.html#onNmeaReceived(long, java.lang.String)>(long timestamp, String<http://developer.android.com/reference/java/lang/String.html> nmea)
See http://developer.android.com/reference/android/location/GpsStatus.NmeaListener.html Regards On Wednesday, October 17, 2012 12:19:32 PM UTC+11, lbendlin wrote: > > You're misunderstanding the concept of how to request location updates. > You should certainly not re-request the service inside onLocationChanged > > On Tuesday, October 16, 2012 9:19:19 AM UTC-4, Muhammad Mehdi wrote: >> >> this code is working fine for Lat long but now im shifting for gps NMEA >> packet its giving me error. i think its in RequestLocationUpdate.. please >> correct me. >> >> protected LocationManager locationManager; >> protected Button retrieveLocationButton; >> >> @Override >> public void onCreate(Bundle savedInstanceState) { >> >> super.onCreate(savedInstanceState); >> setContentView(R.layout.activity_main); >> >> retrieveLocationButton = (Button) >> findViewById(R.id.retrieve_location_button); >> >> locationManager = (LocationManager) >> getSystemService(Context.LOCATION_SERVICE); >> >> >> locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,2000,0,this); >> locationManager.addNmeaListener(this); >> retrieveLocationButton.setOnClickListener(new OnClickListener() { >> @Override >> public void onClick(View v) { >> showCurrentLocation(); >> } >> }); >> } >> >> >> >> protected void showCurrentLocation() { >> // TODO Auto-generated method stub >> } >> >> @SuppressWarnings("unused") >> private abstract class MyLocationListener implements NmeaListener, >> LocationListener { >> >> public void onLocationChanged(Location location) { >> String message = String.copyValueOf(null); >> >> locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this); >> >> boolean isGood = >> locationManager.addNmeaListener((NmeaListener) this); >> >> Toast.makeText(MainActivity.this, message, >> Toast.LENGTH_LONG).show(); >> } >> >> public void onStatusChanged(String s, int i, Bundle b) { >> Toast.makeText(MainActivity.this, "Provider status changed", >> Toast.LENGTH_LONG).show(); >> } >> >> public void onProviderDisabled(String s) { >> Toast.makeText(MainActivity.this, >> "Provider disabled by the user. GPS turned off", >> Toast.LENGTH_LONG).show(); >> } >> >> public void onProviderEnabled(String s) { >> Toast.makeText(MainActivity.this, >> "Provider enabled by the user. GPS turned on", >> Toast.LENGTH_LONG).show(); >> } >> >> } >> >> } >> >> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

