perhaps need to check map api key.

map api key for emulator seems not usable for phone.

On Apr 2, 5:51 am, RMD <[email protected]> wrote:
> The following code will display location data  on the screen in the
> emulator but not on an actual device.  Any ideas on why?
>
> Thank you for any help.
>
> line from android manifest:
> <uses-permission
> android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
> permission>
>
> .java file:
> package xxx.xxxx.xxxx;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import android.app.Activity;
> import android.content.Context;
> import android.location.Location;
> import android.location.LocationListener;
> import android.location.LocationManager;
> import android.os.Bundle;
> import android.util.Log;
> import android.widget.TextView;
>
> public class xxxxxxx extends Activity {
>
>         //Log of GPS data
>         List<String> stalker = new ArrayList<String>();
>
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>
>         //<=================================================
>         //      Calling parent and pass in savedInstanceState
>         //<=================================================
>         super.onCreate(savedInstanceState);
>
>     private void setupListener()
>     {
>         //
> <=========================================================================
>         //      get locationMananger object from the system service map
>         //
> <=========================================================================
>         LocationManager locm = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>
>                 //
> <==========================================================================
>                 //  Instantiate and override methods in the LocationListener
>                 //      Could be done with subclassing
>                 //
> <==========================================================================
>                 LocationListener onLocationChange=new LocationListener() {
>                         public void onLocationChanged(Location location) {
>
>                         } public void onProviderDisabled(String provider) {
>                                 // required for interface, not used
>                         }
>                         public void onProviderEnabled(String provider) {
>                                 // required for interface, not used
>                         }
>                         public void onStatusChanged(String provider, int 
> status,
> Bundle extras) {
>                                 // required for interface, not used
>                         }};
>                         //
> <==================================================================
>                         //      register the listener with the Location 
> Manager to
> receive
>                         //      updates when the nav data changes
>                         //
> <==================================================================
>
>                 locm.requestLocationUpdates("gps", 0, 0,onLocationChange);
>     }
>     //addToLog add location information into already created List
> called Stalker
>     public void addToLog(String v)
>     {
>         //<=========================================================
>         //      Instantiate TextView and pass in a pointer to myself
>         //<=========================================================
>         TextView tv = new TextView(this);
>         tv.setText(v);
>
>         //<=================================================
>         //      Calling parent setContentView
>         //<=================================================
>         setContentView(tv)
>     }
>
>
>
> }

-- 
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to