Using current location, system crashing on ICS - android

I am trying to learn the basics of location services and putting "pins" to mark locations.
I'm not sure whether this is the best approach, or what the alternatives are. What would be a better, or just a simpler way of doing this? Or what is the standard way?
Additionally, when I run this app on ICS 4.0.3, the phone just freezes after a few minutes. It works fine at first, and shows me the location, but eventually the entire device becomes unresponsive. I've checked both logcat and last_kmsg, and I can't find any hints about what is causing this. Gingerbread 2.3.6 runs the code without problems (at least it didn't crash for over 15min, while ICS crashes within 1~5min).
It doesn't seem like an exception, so maybe this is some memory leak or a kernel panic? I'm not sure how to start debugging this :\
Any help would be appreciated!
I am using the following code:
Mapper.java:
public class Mapper extends MapActivity{
MapView mapView;
LocationManager lm;
LocationListener ll;
GeoPoint p;
MapController mc;
MapOverlay overlay;
List<Overlay> lol;
public void onCreate(Bundle x){
super.onCreate(x);
setContentView(R.layout.mapper);
mapView = (MapView)findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();
lol = mapView.getOverlays();
overlay = new MapOverlay();
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
ll = new MyLocationListener();
mapView.invalidate();
}
private class MyLocationListener implements LocationListener{
public void onLocationChanged(Location loc){
if(loc!=null){
int lat = (int)(loc.getLatitude() * 1E6);
int lon = (int)(loc.getLongitude() * 1E6);
p = new GeoPoint(lat,lon);
mc.animateTo(p);
mc.setZoom(18);
lol.clear();
lol.add(overlay);
}
}
#Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
public void onResume(){
super.onResume();
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ll);
}
public void onPause(){
super.onPause();
lm.removeUpdates(ll);
}
protected boolean isRouteDisplayed(){
return false;
}
private class MapOverlay extends com.google.android.maps.Overlay{
public boolean draw(Canvas canvas, MapView mv, boolean shadow, long when){
super.draw(canvas, mv, shadow);
Point sp = new Point();
mv.getProjection().toPixels(p, sp);
Bitmap pic = BitmapFactory.decodeResource(getResources(), R.drawable.image1);
canvas.drawBitmap(pic, sp.x, sp.y, null);
canvas.drawBitmap(pic, sp.x+60, sp.y, null);
canvas.drawBitmap(pic, sp.x-60, sp.y, null);
canvas.drawBitmap(pic, sp.x, sp.y+60, null);
canvas.drawBitmap(pic, sp.x, sp.y-60, null);
return true;
}
}
}
mapper.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="mykeyworks"
android:clickable="true" />
</LinearLayout>
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jinworld"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>"
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="Second Activity" >
<intent-filter>
<action android:name="com.jinworld.SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Notify"
android:label="DEVELOPERS" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Mapper"
android:label="Locatio" >
<intent-filter>
<action android:name="com.jinworld.Mapper" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

You don't need so much code to display your location, google already has an Overlay for this.
Try this, it may helps:
public class Mapper extends MapActivity{
com.google.android.maps.MyLocationOverlay myLocationOverlay;
#Override
protected void onResume() {
super.onResume();
myLocationOverlay.enableMyLocation();
}
#Override
protected void onPause() {
super.onPause();
myLocationOverlay.disableMyLocation();
}
#Override
public void onCreate(Bundle x){
...
setupMyLocation();
...
}
protected void setupMyLocation(){
myLocationOverlay = new MyLocationOverlay(this, mapView);
myLocationOverlay.enableMyLocation();
myLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
mapView.getOverlays().add(myLocationOverlay);
}
});
}
}

Related

AccessibilityService dispatched gesture stops when user touch the screen

I'm trying to make an auto click app with AccessibilityService. I use method dispatchGesture with a AccessibilityService.GestureResultCallback to perform click on the screen and repeat it in onCompleted(). The problem is if I touch the screen before gesture completed, the gesture cancelled (onCancelled fired). How could I prevent screen touch stop my gesture?
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.falcon.autoclick">
<application
android:name=".base.App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AutoClick">
<activity android:name=".ManageConfigActivity" />
<activity android:name=".TestActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".FloatingMenu"
android:enabled="true"
android:exported="false" />
<service
android:name=".AutoService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="#xml/global_action_bar_service" />
</service>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
#xml/global_action_bar_service
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service
xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagDefault"
android:canPerformGestures="true"
android:description="#string/app_name"
android:notificationTimeout="100"
android:settingsActivity=".MainActivity" />
AutoService.java
public static final String EXTRA_ACTION = "auto_service_action";
public static final String ACTION_START_AUTO = "start_auto_click";
public static final String ACTION_STOP_AUTO = "stop_auto_click";
public static final String EXTRA_TARGET = "extra_target";
private Handler handler;
private IntervalRunnable runnable;
private CountDownTimer startTimer;
private CountDownTimer endTimer;
#Override
public void onCreate() {
super.onCreate();
HandlerThread handlerThread = new HandlerThread("auto-handler");
handlerThread.start();
handler = new Handler(handlerThread.getLooper());
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent.getAction();
if (action != null) {
if (action.equals(ACTION_START_AUTO)) {
Target target = (Target) intent.getSerializableExtra(EXTRA_TARGET);
runnable = new IntervalRunnable(target);
handler.postDelayed(runnable, 100);
} else if (action.equals(ACTION_STOP_AUTO)) {
stopAuto();
}
}
return super.onStartCommand(intent, flags, startId);
}
private void stopAuto() {
if (startTimer != null) {
startTimer.cancel();
}
if (endTimer != null) {
endTimer.cancel();
}
handler.removeCallbacks(runnable);
runnable = null;
}
private void startSingleTarget(Target target) {
dispatchGesture(getGestureDescription(target), new AccessibilityService.GestureResultCallback() {
#Override
public void onCompleted(GestureDescription gestureDescription) {
super.onCompleted(gestureDescription);
LogUtil.d("stopwatch", "gesture completed");
startTimer = new CountDownTimer(target.getDelayTime(), 1000) {
#Override
public void onTick(long l) {
}
#Override
public void onFinish() {
handler.post(runnable);
}
}.start();
}
#Override
public void onCancelled(GestureDescription gestureDescription) {
super.onCancelled(gestureDescription);
LogUtil.d("testttttt", "gesture cancelled");
}
}, null);
}
private GestureDescription getGestureDescription(Target target) {
long duration = 0;
GestureDescription.Builder gestureBuilder = new GestureDescription.Builder();
Path path = new Path();
path.moveTo(target.getCenterStartX(), target.getCenterStartY());
if (target.isSwipe()) {
path.lineTo(target.getCenterEndX(), target.getCenterEndY());
duration = target.getSwipeDuration();
} else {
duration = target.getClickDuration();
}
gestureBuilder.addStroke(new GestureDescription.StrokeDescription(path,
0,
duration));
return gestureBuilder.build();
}
private class IntervalRunnable implements Runnable {
private Target target;
public IntervalRunnable(Target target) {
this.target = target;
}
#Override
public void run() {
startSingleTarget(target);
}
}
How could I prevent screen touch stop my gesture?
You can't do that by dispatchGesture. From the official documentation about dispatchGesture: Dispatch a gesture to the touch screen. Any gestures currently in progress, whether from the user, this service, or another service, will be cancelled. Thus, gestures dispatched by your service can be canceled by user.

Android onLocationChanged GPSTracker crashes

I want to send the longitude and latitude from my onLocationChanged method inside the class GPSTracker to GPSPrincipal (Which is my main activity) and activate a toast that shows the longitude and latitude.
I'm having problems with the broadcastreciver to send the data from GPSTracker to GPSPrincipal, also, the aplication crashes and it shows the following error:
FATAL EXCEPTION: main java.lang.NullPointerException at
android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:344)
at
co.edu.javeriana.introcm.gpsexample.GPSTracker.onLocationChanged(GPSTracker.java:192)
The line 192 is:
sendBroadcast(broadcastIntent);
Last line on onLocationChanged inside GPSTracker
GPSPrincipal (Main activity):
public class GPSPrincipal extends Activity {
GPSTracker gps;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gpsprincipal);
}
public void loca(View arg0) {
gps = new GPSTracker(GPSPrincipal.this);
if(gps.canGetLocation()){
TextView latitud = (TextView) findViewById(R.id.showLatitud);
TextView longitud = (TextView) findViewById(R.id.showLongitud);
latitud.setText(String.valueOf(gps.getLatitude()));
longitud.setText(String.valueOf(gps.getLongitude()));}
else {
gps.showSettingsAlert();}
}
public void cambio () {
BroadcastReceiver receiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Located: - \nLat: " + intent.getExtras().get("latitude") + "\nLong: " + intent.getExtras().get("longitude"), Toast.LENGTH_LONG).show();}};
registerReceiver(receiver, new IntentFilter("com.example.broadcast.gps.location_change"));
} }
GPSTracker:
public class GPSTracker extends Service implements LocationListener {
private final Context mContext;
private Location location;
private double latitude; // latitud
private double longitude; // longitud
protected LocationManager locationManager;
public GPSTracker(Context context) {
this.mContext = context; //Obtener el contexto
getLocation();
}
public void onLocationChanged(Location location) {
Intent broadcastIntent = new Intent("com.example.broadcast.gps.location_change");
broadcastIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
broadcastIntent.putExtra("latitude", latitude);
broadcastIntent.putExtra("longitude", longitude);
sendBroadcast(broadcastIntent);
}
Manifest:
package="co.edu.javeriana.introcm.gpsexample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".GPSPrincipal"
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>
Potentially seems to be that your context when calling sendBroadcast() is null within the ContextWrapper class. Perhaps you should try using mContext.sendBroadcast and see if that makes a difference.

Android Studio Estimote Beacon Application

im trying to make basic beacon application in android studio. I just want to scan beacons and list them into the screen. Here are my codes. I took them from somewhere.
public class MainActivity extends ActionBarActivity {
private static final String ESTIMOTE_PROXIMITY_UUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D";
private static final Region ALL_ESTIMOTE_BEACONS = new Region("regionId", null, null, null);
private BeaconManager beaconManager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
beaconManager.setRangingListener(new BeaconManager.RangingListener() {
#Override public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
Log.d("TAG", "Ranged beacons: " + beacons);
}
});
}
#Override
protected void onStart() {
super.onStart();
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
#Override public void onServiceReady() {
try {
beaconManager.startRanging(ALL_ESTIMOTE_BEACONS);
} catch (RemoteException e) {
Log.e("TAG","Cannot start ranging", e);
}
}
});
}
#Override
protected void onStop() {
super.onStop();
try {
beaconManager.stopRanging(ALL_ESTIMOTE_BEACONS);
} catch (RemoteException e) {
Log.e("TAG", "Cannot stop but it does not matter now", e);
}
}
#Override
protected void onDestroy() {
super.onDestroy();
beaconManager.disconnect();
}
}
Here is my manifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.oem.estimote_ibeacon_app" >
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.estimote.sdk.service.BeaconService"
android:exported="false"/>
</application>
</manifest>
When i opened application it says "stopped" please help. I have beacons for test. Where is my mistake? Thank you.
it seems that ALL_ESTIMOTE_BEACONS in
beaconManager.startRanging(ALL_ESTIMOTE_BEACONS);
is null.
enter a valid regionid instead of "regionid" in
private static final Region ALL_ESTIMOTE_BEACONS = new Region("regionId", null, null, null);

why my gps coordinate is being displayed zero?

I'm making this simple app where when a button is placed users gps location should be displayed and it works fine with emulator but when i try that in a real phone both longitude and latitude are zero.
this is my code:
Main Activiy:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView longS = (TextView) findViewById(R.id.longi);
final TextView latiS = (TextView) findViewById(R.id.lati);
Button btn_show_location = (Button) findViewById(R.id.button1);
btn_show_location.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
LocationManager mlocManager=null;
LocationListener mlocListener;
mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
if (mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
if(MyLocationListener.latitude>0)
{
longS.setText("Latitude:- " + MyLocationListener.latitude);
latiS.setText("Longitude:- " + MyLocationListener.longitude + '\n');
}
else
{
longS.setText("Please wait");
}
} else {
Intent gpsOptionsIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(gpsOptionsIntent);
}
}
});
}
MyLocationListener:
public class MyLocationListener implements LocationListener {
public static double latitude;
public static double longitude;
#Override
public void onLocationChanged(Location loc)
{
// loc.getLatitude();
//loc.getLongitude();
latitude=loc.getLatitude();
longitude=loc.getLongitude();
}
#Override
public void onProviderDisabled(String provider)
{
//print "Currently GPS is Disabled";
}
#Override
public void onProviderEnabled(String provider)
{
//print "GPS got Enabled";
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras)
{
}
}
manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.databasecollect"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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>

Android addProximityAlert does not fire

I tried to implement the addProximityAlert method, but it does not fire. Here is my code:
SampleProximityAlert
public class SampleProximityAlert extends Activity {
/** Called when the activity is first created. */
protected LocationManager locationManager;
protected Location location;
public static Location pLocation;
protected Intent intent;
protected PendingIntent pIntent;
protected GeoPoint point;
public float distance;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
locationManager = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE);
location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
try {
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 1000, 1,
new ProximityListener());
} catch (RuntimeException e) {
e.printStackTrace();
}
// point = new GeoPoint(49868004, 8626971);
try {
pLocation = new Location(location.getProvider());
} catch (RuntimeException e) {
e.printStackTrace();
}
Log.i("PROVIDER", location.getProvider());
pLocation.setLatitude(49.868004);
pLocation.setLongitude(8.626971);
distance = methodeDistance(pLocation);
Log.i("DISTANCE", String.valueOf(distance));
Log.i("POSITION",
String.valueOf(location.getLatitude()) + ","
+ String.valueOf(location.getLongitude()));
intent = new Intent(this, ProximityAlert.class);
intent.setAction("ProximityAlert");
pIntent = PendingIntent.getService(this, 0, intent, 0);
locationManager.addProximityAlert(49.868004, 8.626971, 429, 50000,
pIntent);
}
public float methodeDistance(Location mLocation) {
float mDistance = location.distanceTo(pLocation);
return mDistance;
}
}
ProximityAlert
public class ProximityAlert extends Service {
#Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
Log.i("Alert", "fired");
return null;
}
#Override
public void onCreate() {
super.onCreate();
Log.i("ONCREATE", "create ProximityAlert as Service");
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("ONSTARTCOMMAND", "OnStartCommand");
return super.onStartCommand(intent, flags, startId);
}
}
ProximityListener
public class ProximityListener implements LocationListener {
String DEBUG_TAG = "ProximityListener";
#Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
Log.d(DEBUG_TAG, location.toString());
// tvD.setText(String.valueOf(location.distanceTo(pLocation)));
}
#Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
XML Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tsystems.proximityAlert"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".SampleProximityAlert"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ProximityAlert">
<intent-filter>
<action android:name="ProximityAlert"/>
<category android:name="com.proaktiveOrtung"/>
</intent-filter>
</service>
<service android:name=".ProximityAlert"></service>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tsystems.proximityAlert"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".SampleProximityAlert"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ProximityAlert">
<intent-filter>
<action android:name="ProximityAlert"/>
<category android:name="com.proaktiveOrtung"/>
</intent-filter>
</service>
<service android:name=".ProximityAlert"></service>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
Sorry I selected not the complete code.
when you add a ProximityAlert you have to pass a PendingIntent to the LocationManager, these PendingIntent will be fired on a broadcastIntent and i dont see in your code when, where you register a receiver for that PendingIntent.
Now a question... why do you write a service if you add the ProximityAlert on an Activity?

Categories

Resources