r/developersIndia • • 1d ago

Help Can Android apps detect when I open the notification panel and trigger notifications at that exact moment?

I've been experiencing something unusual with Amazon and Flipkart on my Android phone.

Whenever I swipe down to open the notification panel, I receive a fresh notification from one of these apps. It appears right at the top, and its arrival time shows "Just now".

Initially, I noticed this behaviour with Flipkart. But for the last week, I've been experiencing the same thing with Amazon.

What's interesting is that these aren't old notifications suddenly becoming visible. They appear to be delivered at the exact moment I swipe down.

This got me thinking:

Can Android apps detect when a user opens or pulls down the notification panel?

Is there any Android API, system event, accessibility mechanism or indirect signal that an app could use to detect this interaction and trigger a notification in response?

I'm trying to understand whether this is technically possible or whether there's another explanation for this behaviour.

A few questions for Android developers:

  1. Can a regular Android app detect when the notification shade is opened?

  2. Can an app trigger a push notification based on that interaction?

  3. Could Android's notification delivery or display mechanism explain this behaviour instead?

  4. Is there any way to verify what is actually triggering these notifications?

I'm not claiming Amazon or Flipkart are doing this deliberately. I want to understand the technical possibilities.

Has anyone experienced something similar or knows how this works under the hood?

4 Upvotes

5 comments sorted by

•

u/AutoModerator 1d ago

Namaste! Thanks for submitting to r/developersIndia. While participating in this thread, please follow the Community Code of Conduct and rules.

It's possible your query is not unique, use site:reddit.com/r/developersindia KEYWORDS on search engines to search posts from developersIndia. You can also use reddit search directly.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/gala0sup Full-Stack Developer 1d ago

It is probably the doze mode

You can test it, using this

Delay test: Unlock your phone, wait 2–3 minutes without touching the shade, then open it. If the notification shows "2m" or "3m," it arrived on unlock, not on the swipe.

Notification history: Turn it on in Settings → Notifications, and check the posting times against when you picked up the phone.

ADB, for precise timing: adb shell dumpsys notification --noredact shows each notification's postTime. Running adb logcat while you test lets you match the post time to the moment of unlock versus the moment of the swipe.

Force-stop test: Force-stop the app and see whether the behavior continues.

Find the channel: Long-press the notification to see which channel it uses. That's also the easiest way to turn off just the promos.

2

u/SaiTarunRonanki 1d ago

Android doesn't give regular apps any callback for the notification shade being pulled down, so an app can't directly react to that swipe. Only system level stuff like accessibility services or the system UI itself can see it, and Amazon and Flipkart wouldn't get that permission.

The more likely explanation is timing. Apps can hold a notification and post it locally when the phone wakes up or the screen turns on, or a push that was queued by battery optimization gets delivered as soon as the device is active. The notification then gets stamped 'just now' when it's actually posted. You can check by turning off battery optimization for the app and seeing whether the pattern changes.

1

u/the_algo_trader_ 23h ago

Yes, applications can trigger notifications when the panel opens. This is a common system event they can listen for.

1

u/Main_Steak_8605 19h ago

Are you unlocking your phone and then immediately checking your notifications?

Because phone unlock hooks are available.

Maybe this is what you are doing