Slove this(may b the trouble on pending intent)

9 views
Skip to first unread message

Minindu Wirochana

unread,
Feb 22, 2013, 10:58:28 AM2/22/13
to hybr...@googlegroups.com
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();
slv.jpg

Dewmal Handapangoda

unread,
Feb 22, 2013, 11:08:13 AM2/22/13
to Minindu Wirochana, hybr...@googlegroups.com
I told you about Thread is not working on there?

you have to check Location Application again.

check this

http://stackoverflow.com/questions/1921514/how-to-run-a-runnable-thread-in-android

--
You received this message because you are subscribed to the Google Groups "Ijse Hybrid Application Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hybriddev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dewmal Handapangoda

unread,
Feb 22, 2013, 11:10:10 AM2/22/13
to Minindu Wirochana, hybr...@googlegroups.com
Also you don't have permission to Access Vibrate.
Reply all
Reply to author
Forward
0 new messages