Android function
4518
£42(approx. $52)
- Posted:
- Proposals: 4
- Remote
- #102047
- Archived
Description
Experience Level: Intermediate
i am developping an android application, the app receives notifications from a server, whenever a notification is received it pops up the the notification area of the android, when clicked it gives you access to the application...what i need is to set a confirmation after the notification is clicked on the mobile and depending on the user choice, if he clicks OK then it posts a variable to an HTTP link, if he clicks cancel then nothing happens... i am using the following code for now that when an incoming notification is clicked it only opens the application... thank you for your prompt help coz i need this very fast...thanks again.
private void showNotification(String text) {
Notification n = new Notification();
n.flags |= Notification.FLAG_SHOW_LIGHTS;
n.flags |= Notification.FLAG_AUTO_CANCEL;
n.defaults = Notification.DEFAULT_ALL;
n.icon = R.drawable.icon;
n.when = System.currentTimeMillis();
// Simply open the parent activity
PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, Home.class), 0);
// Change the name of the notification here
n.setLatestEventInfo(this, NOTIF_TITLE, text, pi);
mNotifMan.notify(NOTIF_CONNECTED, n);
// CharSequence text2 = "Hello toast!";
// int duration = Toast.LENGTH_SHORT;
//Toast toast = Toast.makeText(context, text2, duration);
// toast.show();
}
if you also need my project file i will also give it. thanks!
private void showNotification(String text) {
Notification n = new Notification();
n.flags |= Notification.FLAG_SHOW_LIGHTS;
n.flags |= Notification.FLAG_AUTO_CANCEL;
n.defaults = Notification.DEFAULT_ALL;
n.icon = R.drawable.icon;
n.when = System.currentTimeMillis();
// Simply open the parent activity
PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, Home.class), 0);
// Change the name of the notification here
n.setLatestEventInfo(this, NOTIF_TITLE, text, pi);
mNotifMan.notify(NOTIF_CONNECTED, n);
// CharSequence text2 = "Hello toast!";
// int duration = Toast.LENGTH_SHORT;
//Toast toast = Toast.makeText(context, text2, duration);
// toast.show();
}
if you also need my project file i will also give it. thanks!
Ramzy Z.
0% (0)Projects Completed
2
Freelancers worked with
2
Projects awarded
20%
Last project
22 Jun 2012
Lebanon
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies