NotifyMe icon indicating copy to clipboard operation
NotifyMe copied to clipboard

how to make notify me in oncreate ?

Open iwebnetid opened this issue 5 years ago • 1 comments

your library's awesome ...

but when i put the notifyme function in oncreate like this :

Intent intent = new Intent(getApplicationContext(),TestActivity.class);
        intent.putExtra("test","I am a String");

        Calendar then = Calendar.getInstance();

        then.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
        then.set(Calendar.MONTH, Calendar.getInstance().get(Calendar.MONTH));
        then.set(Calendar.DAY_OF_MONTH, 5);

        then.set(Calendar.HOUR_OF_DAY, 23);
        then.set(Calendar.MINUTE, 39);
        then.set(Calendar.SECOND,0);



        NotifyMe notifyMe = new NotifyMe.Builder(getApplicationContext())
                .title("test")
                .content("test content")
                .color(255,0,0,255)
                .led_color(255,255,255,255)
                .time(then)
                .addAction(intent,"Snooze",false)
                .key("test")
                .addAction(new Intent(),"Dismiss",true,false)
                .addAction(intent,"Done")
                .large_icon(R.mipmap.ic_launcher_round)
                .build();

will create infinite loop for the notification, so how to cancel it ? thank you

iwebnetid avatar Apr 05 '19 16:04 iwebnetid

Maybe you can put this "questioning before proceeding" coding before the NotifyMe functions.

new AlertDialog.Builder(this) .setTitle("Preset an audio") .setMessage("Are you sure you want to preset?")

            // Specifying a listener allows you to take an action before dismissing the dialog.
            // The dialog is automatically dismissed when a dialog button is clicked.
            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    // Continue operation
                }
            })

            // A null listener allows the button to dismiss the dialog and take no further action.
            .setNegativeButton(android.R.string.no, null)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .show();

hannani17 avatar Aug 20 '19 02:08 hannani17