Programmatically switch between large view and normal view for Android notification using the notification action button

I have a service that works in the foreground (continuous notification). I want to give users a button to close it, so I thought about a notification (in 4.1) But, before closing it, I want to inform them of the consequences of closing it and give them confirmation of closing.

So I want the normal view of my notification to have a close button, and when the user clicks on it, I want to expand my notification to a large view that has confirmation / cancel buttons.

From what I read, I can’t control which view is presented to the user. It will only show a large view. If this is the first notification or the user clicks to enlarge it / swipe down.

Can I control which presentation is presented?

Thanks!

+6
source share
1 answer

No, you have no control over this part.

It is processed by the system, and until Android 4.1 you will not get a β€œbig view”.

You are using notices that they should not be used.

If the user has chosen to delete your notification, he is not interested in the notification, and you can not do anything about it.

The user may also decide to stop your application for notifications.

You cannot rely on a notice of such things.

If you explain exactly what your stream is, I might be more helpful.

0
source

Source: https://habr.com/ru/post/953057/


All Articles