Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Alarm icon is not shown ONLY on Samsung Android 9 devices when set with AlarmManager.setAlarmClock()?

I use AlarmManager.setAlarmClock() to set an alarm. Alarm is fired on all devices, including Samsung, but the small alarm icon near the clock (top right corner of the screen) is missing on Samsung devices with Android 9. What am I missing here?

I know that the issue has also affected Google Clock application, but it was fixed recently.

My code:

val pendingAlarm = Intent(ACTION_FIRED)
    .apply {
        setClass(mContext, AlarmsReceiver::class.java)
        putExtra(EXTRA_ID, id)
        putExtra(EXTRA_TYPE, typeName)
     }
     .let { PendingIntent.getBroadcast(mContext, pendingAlarmRequestCode, it, PendingIntent.FLAG_UPDATE_CURRENT) }

 val pendingShowList = PendingIntent.getActivity(
     mContext,
     100500,
     Intent(mContext, AlarmsListActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT)

 am.setAlarmClock(AlarmManager.AlarmClockInfo(calendar.timeInMillis, pendingShowList), pendingAlarm)
like image 990
Yuriy Kulikov Avatar asked Jul 14 '19 14:07

Yuriy Kulikov


People also ask

Why is there an alarm clock icon on my Samsung phone?

1 Check whether the alarm has been enabled by a third-party app. An alarm icon will be displayed on the status bar if you have set up an alarm or reminder in a third-party app.

What is alarm in Android?

The alarm is an Intent broadcast that goes to a broadcast receiver that you registered with Context. registerReceiver(BroadcastReceiver, IntentFilter) or through the <receiver> tag in an AndroidManifest. xml file. Alarm intents are delivered with a data extra of type int called Intent.

What is exact alarm?

Set an exact alarm. The system invokes an exact alarm at a precise moment in the future. If your app targets Android 12 or higher, you must declare one of the "Alarms & reminders" permissions; otherwise, a SecurityException occurs. Your app can set exact alarms using one of the following methods.


1 Answers

From what I can tell, I think this is because of samsungs specific implementation of the android OS and seems to be related to the samsung OS implementation itself.

I found one thread discussing something very similar, which might be of some help: enter image description here (found here: https://www.reddit.com/r/GalaxyS9/comments/anck2x/google_clock_no_upcoming_alarm_iconnotification/)

and i found another discussion regarding the same topic found here : (https://forums.androidcentral.com/samsung-galaxy-note-9/952204-alarm-icon.html) enter image description here

enter image description here

it seems as if the OS only shows alarm indications a specific amount of time before the alarm goes off (some people are saying 30 minutes roughly, maybe OP can test to verify that)

This answer is not extremely useful and it's a bit all-over, but it seems to be reliant on the specific implementation of the android OS on the samsung device

like image 174
a_local_nobody Avatar answered Sep 19 '22 22:09

a_local_nobody