new Thread(new MyNotification() {
Location locationn;
CoustomLocationListener coustomLocationListener;
//**********
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
private static final int NOTIFY_ME_ID = 1337;
private int count = 0;
android.app.Notification notifyObj;
PendingIntent i;
@Override
public void update(Observable observable, Object data) {
// TODO Auto-generated method stub
CoustomLocationListener coustomLocationListener = (CoustomLocationListener) observable;
this.locationn = coustomLocationListener
.getCurrentLocation();
distance = distFrom(latitude, longitude,
locationn.getLatitude(),
locationn.getLongitude());
Log.d("Nofiy" + locationn.getLatitude(), "not"
+ locationn.getLongitude());
Log.d("Distance", "" + distance);
}
@Override
public void run() {
coustomLocationListener = (CoustomLocationListener) CoustomLocationListener
.getCustomeLocationListener();
coustomLocationListener.addObserver(this);
Log.d("Thread", "Start");
while (true) {
if (locationn != null) {
while (distance > 1000) {
}
Log.d("Thread", "End");
//***********
notifyObj = new android.app.Notification();
// meka awlak thibe..
i = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), 0);
//LocationSelecter.this,ClickNofifyActivity.class
notifyObj.setLatestEventInfo(
LocationSelecter.this,
"Notification Created",
"Click here to see the message", i);
notifyObj.number = ++count;
notifyObj.defaults|=Notification.DEFAULT_VIBRATE;
notifyObj.defaults |= Notification.DEFAULT_SOUND;
notifyObj.flags |= Notification.FLAG_AUTO_CANCEL;
//notification.sound = Uri.parse("file:///sdcard/notification/notification.mp3");
notificationManager.notify(NOTIFY_ME_ID,
notifyObj);
return;
} else {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}).start();