I try to use the DDMS location mockup with a very simple Log.i() call in the functions of all LocationListener attributes. When I start the program I get the Log.i() message for onStatusChanged() in my LogCat, so I think that I registered the listener correctly. But when I put a location into the VM using the DDMS menus in Eclipse I get nothing. No change in LogCat, Console, or inside the VM. As if nothing happened at all.
How can I even start to find the problem?
Here is the code for my simple GPS Event logger:
public class gpsActivity extends Activity {
private static final String TAG="gpsActivity";
private static TextView label;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
label = (TextView) findViewById(R.id.label);
LocationManager manager = (LocationManager) this
.getSystemService(LOCATION_SERVICE);
LocationListener listener = new LocationListener() {
@Override
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
Log.i(TAG, "onStatusChanged: "+arg0);
}
@Override
public void onProviderEnabled(String arg0) {
Log.i(TAG, "onProviderEnabled: "+arg0);
}
@Override
public void onProviderDisabled(String arg0) {
Log.i(TAG, "onProviderDisabled: "+arg0);
}
@Override
public void onLocationChanged(Location location) {
Log.i(TAG, "onLocationChanged");
}
};
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2, 0,
listener);
setContentView(R.layout.main);
}
}
and here the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage.example.gps"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".gpsActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Also as another side note, I am using a German Windows XP and found out that there are problems with GPS packages, because in a German system the number format for 1/2 is not 0.5 but 0,5 which leads to errors in the GPS parser grammar. But also changing my systems number format to English(US) didn’t change that I don’t get any message, exception or result at all.
There where 3 problems involved. Because finding all of them took more then 12 hours of pure research time please excuse that I won’t even try to find the according sources again.
The problems involved where:
Google API <version>as target and notAndroid <version>because there are nesssesary things not activated in the latter.Good luck to everybody who tries his way to this kind of errors!