use of android.app.PendingIntent in project cw-android by commonsguy.
the class NotifyDemo method notifyMe.
public void notifyMe(View v) {
Notification note = new Notification(R.drawable.stat_notify_chat, "Status message!", System.currentTimeMillis());
PendingIntent i = PendingIntent.getActivity(this, 0, new Intent(this, NotifyMessage.class), 0);
note.setLatestEventInfo(this, "Notification Title", "This is the notification message", i);
note.number = ++count;
note.vibrate = new long[] { 500L, 200L, 200L, 500L };
note.flags |= Notification.FLAG_AUTO_CANCEL;
mgr.notify(NOTIFY_ME_ID, note);
}
use of android.app.PendingIntent in project AnimeTaste by daimajia.
the class MissionListenerForNotification method onSuccess.
//todo:修复
@Override
public void onSuccess(M3U8Mission mission) {
Intent intent = new Intent(context, PlayActivity.class);
Animation animation = (Animation) mission.getExtraInformation(mission.getUri());
intent.putExtra("Animation", animation);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
notifyBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_action_emo_wink).setContentTitle(mission.getShowName()).setContentText(context.getString(R.string.download_success)).setProgress(100, mission.getPercentage(), false).setContentIntent(pendingIntent).setOngoing(false);
notificationManager.notify(mission.getMissionID(), notifyBuilder.build());
MobclickAgent.onEvent(context, "download_success");
}
use of android.app.PendingIntent in project android-gcm by chiuki.
the class GCMIntentService method prepareNotification.
private Notification prepareNotification(Context context, String msg) {
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.ic_stat_cloud, msg, when);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(context, MessageActivity.class);
// Set a unique data uri for each notification to make sure the activity
// gets updated
intent.setData(Uri.parse(msg));
intent.putExtra(Constants.FIELD_MESSAGE, msg);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
String title = context.getString(R.string.app_name);
notification.setLatestEventInfo(context, title, msg, pendingIntent);
return notification;
}
use of android.app.PendingIntent in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i = new Intent(this, VoiceReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
RemoteInput remoteInput = new RemoteInput.Builder(VoiceReceiver.EXTRA_SPEECH).setLabel(getString(R.string.talk)).setChoices(getResources().getStringArray(R.array.replies)).build();
NotificationCompat.Action wearAction = new NotificationCompat.Action.Builder(android.R.drawable.ic_btn_speak_now, getString(R.string.talk), pi).addRemoteInput(remoteInput).build();
NotificationCompat.WearableExtender wearExtender = new NotificationCompat.WearableExtender().addAction(wearAction);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(android.R.drawable.stat_sys_download_done).setContentTitle(getString(R.string.title)).setContentText(getString(R.string.talk)).extend(wearExtender);
NotificationManagerCompat.from(this).notify(NOTIFY_ID, builder.build());
finish();
}
use of android.app.PendingIntent in project cw-omnibus by commonsguy.
the class PollReceiver method scheduleAlarms.
static void scheduleAlarms(Context ctxt) {
AlarmManager mgr = (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE);
Thingy thingy = new Thingy(mgr.getClass().getCanonicalName(), mgr.hashCode());
Intent i = new Intent(ctxt, PollReceiver.class).putExtra(EXTRA_THINGY, Parcelables.toByteArray(thingy));
PendingIntent pi = PendingIntent.getBroadcast(ctxt, 0, i, 0);
mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + INITIAL_DELAY, PERIOD, pi);
}
Aggregations