List of usage examples for android.provider CalendarContract EXTRA_EVENT_ALL_DAY
String EXTRA_EVENT_ALL_DAY
To view the source code for android.provider CalendarContract EXTRA_EVENT_ALL_DAY.
Click Source Link
From source file:fr.bde_eseo.eseomega.events.EventItem.java
public Intent toCalendarIntent() { Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra(CalendarContract.Events.TITLE, name); calIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, (lieu != null ? lieu : "")); calIntent.putExtra(CalendarContract.Events.DESCRIPTION, (details != null ? details : "")); SimpleDateFormat sdf = new SimpleDateFormat("HH'h'mm", Locale.FRANCE); String sDate = sdf.format(this.date); boolean allDay = sDate.equals(HOUR_PASS_ALLDAY); calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, allDay); calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, cal.getTimeInMillis()); if (!allDay)//from w w w . j a v a 2 s . c om calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, calFin.getTimeInMillis()); return calIntent; }
From source file:com.salesforce.marketingcloud.android.demoapp.LearningAppApplication.java
@Override public NotificationCompat.Builder setupNotificationBuilder(@NonNull Context context, @NonNull NotificationMessage notificationMessage) { NotificationCompat.Builder builder = NotificationManager.getDefaultNotificationBuilder(context, notificationMessage, NotificationManager.createDefaultNotificationChannel(context), R.drawable.ic_stat_app_logo_transparent); Map<String, String> customKeys = notificationMessage.customKeys(); if (!customKeys.containsKey("category") || !customKeys.containsKey("sale_date")) { return builder; }//from ww w. j a v a 2 s. com if ("sale".equalsIgnoreCase(customKeys.get("category"))) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); simpleDateFormat.setTimeZone(TimeZone.getDefault()); try { Date saleDate = simpleDateFormat.parse(customKeys.get("sale_date")); Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, saleDate.getTime()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, saleDate.getTime()) .putExtra(CalendarContract.Events.TITLE, customKeys.get("event_title")) .putExtra(CalendarContract.Events.DESCRIPTION, customKeys.get("alert")) .putExtra(CalendarContract.Events.HAS_ALARM, 1) .putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); PendingIntent pendingIntent = PendingIntent.getActivity(context, R.id.interactive_notification_reminder, intent, PendingIntent.FLAG_CANCEL_CURRENT); builder.addAction(android.R.drawable.ic_menu_my_calendar, getString(R.string.in_btn_add_reminder), pendingIntent); } catch (ParseException e) { Log.e(TAG, e.getMessage(), e); } } return builder; }