lundi 24 avril 2017

I want to give notification to the user (mobile application) when the if block is execute. this code doesn't work, what is wrong with my code?

if (200 <= intId && intId <= 250) {//if there is some Thondering give a alert

                    Notification noti = new Notification.Builder(MainActivity.this)
                            .setTicker("Tickertittle")
                            .setContentTitle("ELEKTRA WEATHER ALERT")
                            .setContentText("TURN OFF the multi plug for lighting safety")
                            .setContentIntent();

                       noti.flags = Notification.FLAG_AUTO_CANCEL;
                       NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
                       nm.notify(0,noti);

                }

Aucun commentaire:

Enregistrer un commentaire