Similar to this problem: http://stackoverflow.com/questions/3950026/problem-with-getting-gps-data-when-using-camerapreview
Any suggestion about the conflicts between using GPS and Camera? The following is a code to test the conflict. package com.example.helloandroid; import android.app.Activity; import android.content.Context; import android.hardware.Camera; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.widget.Toast; public class HelloAndroid extends Activity { LocationManager mlocManager; LocationListener mlocListener; Camera camera; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Use the LocationManager class to obtain GPS locations */ mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener); camera = Camera.open();// If you comment this line, the GPS will work } @Override protected void onDestroy() { mlocManager.removeUpdates(mlocListener); super.onDestroy(); } /* Class My Location Listener */ public class MyLocationListener implements LocationListener { public void onLocationChanged(Location loc) { String Text = "My current location is:\n" + "Latitud = " + loc.getLatitude() + "\nLongitud = " + loc.getLongitude()+ "\nAccuracy = "+ loc.getAccuracy(); Toast.makeText(getApplicationContext(),Text,Toast.LENGTH_SHORT).show(); Log.d("GPS", "getSpeed = " + loc.getSpeed()+" Latitud = " + loc.getLatitude()+" Longitud = " + loc.getLongitude()); } public void onProviderDisabled(String provider) { Toast.makeText(getApplicationContext(),"Gps Disabled",Toast.LENGTH_SHORT ).show(); } public void onProviderEnabled(String provider) { Toast.makeText(getApplicationContext(),"Gps Enabled",Toast.LENGTH_SHORT).show(); } public void onStatusChanged(String provider, int status, Bundle extras){} } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en