java - Android prompt notification automatically code -


here i'm try develop android application prompt user notification reminder automatically. notification prompts user when meet condition.

for case, application personal recorder application, requires user record data everyday. if whole day application detects there no data entry, prompt reminder @ specific time remind user launch application , enter data.

for example, @ 10.00pm, user never launch application day, application prompt reminder "please make sure data updated!".

how code work? have refer many tutorial seem not want. thank you.

the android documentation suggests should use alarm manager register intent fire @ specified time if application may not running.

and when happens, fire notification.

m_notificationbuilder = new notificationcompat.builder(this)                 .setcontenttitle(title)                 .setcontenttext(textmessage)                 .setsubtext(subtextmessage)                 .setsmallicon(r.drawable.ic_launcher_notification)                 .setcolor(color.red)                 .setautocancel(true)                 .setpriority(notificationcompat.priority_high)                 .setsound(settings.system.default_notification_uri)                 .setvibrate(new long[]{1000, 100}); 

use notification manager notify after have constructed notification.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -