If somebody can get this to work for me, using an emulator on the 1.5
sdk, I will send them $25 via paypal if you need it. I am using the
android 1.5 emulator.
Problem: I see the satilite icon on the top of the phone, but when I
send the device multiple coordinates, is never runs the
onLocationChange method.
Assumptions: Ignore the "WakefulIntentService". Its just a
modification of the service class, by Mark Murphy, that keeps the
service running.
Question: Why isn't the emulator / my phone triggering
onLocationChange, but displaying an icon signifying GPS is active when
onHandleIntent is called? (And until stopUpdates is called). And, what
can I do to fix this?
Code (FmiLocationManager.java):
=========code=========
package org.myProj;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.location.Criteria;
public class FmiLocationManager extends WakefulIntentService
implements LocationListener
{
private LocationManager locationMan;
private LocationListener locationLis;
public FmiLocationManager()
{
super("FmiLocationManager");
}
@Override
protected void onHandleIntent(Intent intent) {
super.onHandleIntent(intent);
locationMan = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
locationMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
0, this);
String provider = "gps"; //(Available on the emulator, I tested
it)
locationMan.requestLocationUpdates(
provider,
13000,
3,
this);
}
}
public void onStop()
{
stopUpdates();
}
public void stopUpdates()
{
if(locationLis != null)
locationMan.removeUpdates(locationLis);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onLocationChanged(Location loc) {
Log.e("fmi","fmi new location received");
//NEVER gets sent.
}
public void onProviderDisabled(String provider) {
}
public void onProviderEnabled(String provider) {
}
public void onStatusChanged(String provider, int status,
Bundle extras) {
}
}
==========end code========
Manifest:
I won't post the entire thing, but here is the important information:
android:versionName="1.0"
android:versionCode="1"
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
permission>
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-
permission>
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-
permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-
permission>
<service android:name=".FmiLocationManager" />
------------------------------------------------------------------------
--
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