I'm new to android and I have the following code in my Service :
int icon = R.drawable.gcm_notification;
long when = System.currentTimeMillis();
String notificationText = "Message From SimplePay";
//get the notification service
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon,
This is my code for sending an HTML email in Android, with a clickable link.
private void sendEmail()
{
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String subject = "Prueba";
String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";
emailIntent.setType("message/rfc822");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent
Need some help with building an Jelly Bean notification with custom button (using addAction).
The problem is, that i cannot just make it working.
Basically, i want to build notification with following parameters: on notification click it must bring one of my activities up, on button click - play-pause player, which is running, when notification is shown.
My code is:
Receiver:
private BroadcastRe
Can somebody explain this to me please :
Intent intent = new Intent(Context, AlarmReceiver.class);
I never understood and I seriously think I never will if somebody doesn't try to explain this to me in depth. This whole context thing is so confusing to me.
When i'm using startActivity from a receiver like this:
public void onReceive(final Context context, final Intent intent) {
Intent i = new Intent();
i.setClass(context, NewClass.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
i.addFlags(Intent.FLAG_AC
this is my receiver.viewChanger is my original class .
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
viewChanger vc = new viewChanger();
if(action.equals("android.intent.action.TIME_TICK")){
vc.setDateView(context);
}else if(action.equals("android.intent.action.BATTERY_CHANGED")){
int level
I have an android app successfully set up to receive notifications using Urban Airship, but am running into problems in handling the PushManager.ACTION_NOTIFICATION_OPENED) broadcast.
this is my code for setting alarm:
public void SetAlarm(Context context, int tag, long time){
AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, Alarm.class);
i.putExtra("position", tag);
PendingIntent pi = PendingIntent.getBroadcast(context, tag, i, PendingIntent.FLAG_CANCEL_CURRENT);
am.set(AlarmManager.RTC_WAKE
I am trying to setup a BroadcastReceiver to handle scheduled events. I have been following http://mobile.tutsplus.com/tutorials/android/android-fundamentals-schedu... , and had the feature working, or so I believed.