Home / Android F F P / How to refresh activity on new notification click – Android developer

How to refresh activity on new notification click – Android developer

In some case we face this kind of issue..

In a specific activity we are active then new notification arrives.. In this case if user click on the notification we need to refresh the activity with new data from the notification.

While using push notification service for example: firebase notification android developer face this issue..

There are two way to solve this issue.. one is brodcast the new message with data instantly or wait for user’s action like click on the notification..

When user click on the notification you need to override “onNewIntent” on that specific activity which you want to refresh.

Then in onNewIntent you need to handle the new intent data served by the notification you previously used for get intent and show data in the activity.

Then the “onNewIntent “ will refresh the present activity with the new intent data served by the notification.

By this way you can always use onNewIntent in your android app for refresh present activity with new intnet data

 

If you stil;l have any problem related handaling new notification in the same activity then feel free to comment.. I will try to reply all of your questions.

 

About Rana

Rana
Love to do fun with programming and build something new.. :)

Check Also

fab

How to change fab(floating action bar) color android

Floating action bar is an attractive implementation in android material design. Any one can do …

Leave a Reply

Your email address will not be published. Required fields are marked *