Skip to content
Advertisement

Action button on Notification if not clicked on certain time will do something else

I have an app that if something happens it will pop up a Notification with an action button. if it pressed it will the app running but if not for a certain amount of time it will run another code. I’m still confused about how to make that

EDIT :

Here is The code I tried Main Activity.java :

JavaScript

if something happens it will pop up a Notification with an action button is on this code

JavaScript

Advertisement

Answer

From your example. You could pass the current time into the intent.

So from your MainActivity.java

JavaScript

Then when you receive it within the NotificationReceiver.java Compare the date time etc.

JavaScript

}

Just make sure to check the intent has data etc.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement