I want to have a push notification display in the status bar after the user receives 3 text messages. I then want to start a new activity after that notification is clicked. I have been searching around and haven't found any help with setting up this condition for sending out a push notification.
One option would be to use a Service.
You would first use an AlarmManager to start your Service on a set schedule (say every half hour). Your Service would then perform the logic necessary to check if a word needs a review and show a notification as appropriate.
A basic service that performs this functionality would look something like this:
public class ReviewCheckService extends IntentService {
public ReviewCheckService() {}
@Override
protected void onHandleIntent(Intent intent) {
if (isNeedReview()) {
showNotification();
}
}
}
for reading about Service you can see this site
要了解如何实施Android Notification, 请访问此网站以获取教程
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.