- Updated AdMob SDK
- Fix use of GPS from AdMob that was draining the battery - Added Froyo app2sd support - Some minor cleanups
This commit is contained in:
parent
fbbd2673ff
commit
cef1b4d481
9 changed files with 21 additions and 24 deletions
|
@ -1,5 +1,7 @@
|
|||
package org.r3pek.pharmacies;
|
||||
|
||||
import com.admob.android.ads.AdView;
|
||||
|
||||
import org.r3pek.pharmacies.utils.GeoUtils;
|
||||
import org.r3pek.pharmacies.utils.GlobalVars;
|
||||
import org.r3pek.pharmacies.widgets.Arrow;
|
||||
|
@ -73,6 +75,8 @@ public class PharmacyInfo extends Activity {
|
|||
public void onPause() {
|
||||
arrowChangerSensor.delImage((Arrow)findViewById(R.id.ivInfoDirection));
|
||||
sm.unregisterListener(arrowChangerSensor);
|
||||
AdView ad = (AdView) findViewById(R.id.ad);
|
||||
ad.cleanup();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package org.r3pek.pharmacies.utils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import com.google.android.maps.GeoPoint;
|
||||
|
||||
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 com.google.android.maps.GeoPoint;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class Positioner implements LocationListener {
|
||||
private Location currentLocation;
|
||||
|
@ -57,7 +56,6 @@ public class Positioner implements LocationListener {
|
|||
|
||||
public void requestUpdates() {
|
||||
if (isUpdating) return;
|
||||
Log.d("Positioner", "Enabling location Updates");
|
||||
|
||||
if (getBestLocationProvider().equals(LocationManager.GPS_PROVIDER) && !hadGPSFix)
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
||||
|
@ -68,7 +66,6 @@ public class Positioner implements LocationListener {
|
|||
|
||||
public void cancelUpdates() {
|
||||
if (!isUpdating) return;
|
||||
Log.d("Positioner", "Disabling location Updates");
|
||||
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
|
@ -81,12 +78,10 @@ public class Positioner implements LocationListener {
|
|||
}
|
||||
|
||||
public void registerNotification(OnPositionChangeListener object) {
|
||||
Log.d("Positioner", "Adding notification " + object.getClass().getCanonicalName());
|
||||
toNotify.add(object);
|
||||
}
|
||||
|
||||
public void unregisterNotification(OnPositionChangeListener object) {
|
||||
Log.d("Positioner", "Removing notification " + object.getClass().getCanonicalName());
|
||||
toNotify.remove(object);
|
||||
}
|
||||
|
||||
|
@ -104,8 +99,6 @@ public class Positioner implements LocationListener {
|
|||
|
||||
@Override
|
||||
public synchronized void onLocationChanged(Location location) {
|
||||
Log.d("Positioner", "New location arrived");
|
||||
|
||||
/* If we already have a GPS fix, discard Network locations */
|
||||
if (hadGPSFix && location.getProvider().equals(LocationManager.NETWORK_PROVIDER))
|
||||
return;
|
||||
|
@ -136,7 +129,6 @@ public class Positioner implements LocationListener {
|
|||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
Log.d("Positioner", "Provider enabled: " + provider);
|
||||
initLocation();
|
||||
}
|
||||
|
||||
|
@ -145,7 +137,6 @@ public class Positioner implements LocationListener {
|
|||
}
|
||||
|
||||
private synchronized void notifyAllClients() {
|
||||
Log.d("Positioner", "Notifying clients");
|
||||
for (OnPositionChangeListener l : toNotify)
|
||||
l.onLocationChange(currentGeoPoint, currentAccuracy);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue