Status Update
Comments
vi...@google.com <vi...@google.com> #2
What steps are needed to reproduce this issue? Frequency of occurrence?
Which Android build are you using? (e.g. TQ3A.230705.001.A1)
Which device did you use to reproduce this issue?
Can you confirm if this issue is reproducible on a Pixel/Nexus device?
Please provide a sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Android bug report (to be captured after reproducing the issue)
For steps to capture a bug report, please refer:
Alternate method
Navigate to “Developer options”, ensure “USB debugging” is enabled, then enable “Bug report shortcut”. Capture bug report by holding the power button and selecting the “Take bug report” option.
Note: Please upload the bug report and screenshot to google drive and share the folder to android-bugreport@google.com, then share the link here.
ke...@gmail.com <ke...@gmail.com> #3
The steps needed to reproduce this issue are to try and follow my code examples. But I'll provide a sample project for you (I'm hoping to be able to create it tonight or tomorrow). With the sample project it will probably be something like this:
- Click on the plus button
- Choose a time (I'd suggest a minute from now)
- Wait until the minute is passed
- No Activity will be shown
- I'll provide some commented out code to test out the different scenarios I've tested.
I've been trying this on the emulator (Wear OS Small Round API 33 arm64-v8a Android 13 (Wear OS 4)) and my Pixel watch 2 (Wear OS 4.0 with Build number TWD9.240805.001.A2 and Android security patch 5 July 2024). I'm using compile and targetSdk of 34.
ke...@gmail.com <ke...@gmail.com> #4
Okay, I made a sample project. I tried to remove as much as I could so it is only testing the AlarmManager starting an Activity. So to test do the following: Click on the plus button, select a minute in the future, accept push permission, confirm again, press the home button, after a minute no Activity will be shown.
In AlarmUtils
you can uncomment line 40 (and comment line 38) to test the PendingIntent using the Activity
. Then follow the same steps above. In AlarmBroadcastReceiver
there is also some commented code. You can uncomment that (and comment the other part) to test starting an Activity
from the BroadcastReceiver
. Both will not work, but these are some tests I've done. In AlarmBroadcastReceiver
and AlarmActivity
I placed a log so you can see in Logcat if the specific code is being called.
Let me know if I need to give extra clarifications or if you have any questions.
vi...@google.com <vi...@google.com> #5
Also share the full bug report after the issue was reproduced:
Android bug report (to be captured after reproducing the issue)
For steps to capture a bug report, please refer:
Alternate method
Navigate to “Developer options”, ensure “USB debugging” is enabled, then enable “Bug report shortcut”. Capture bug report by holding the power button and selecting the “Take bug report” option.
Note: Please upload the bug report and screenshot to google drive and share the folder to android-bugreport@google.com, then share the link here.
ke...@gmail.com <ke...@gmail.com> #6
That's because it is the entire sample project and not an apk. I'll also provide an apk, but then you can only test a single variant of the things I've tried.
Attached is the bug report and the apk. Both after testing the foreground service with FullScreenIntent. But I'd suggest also looking at the project and testing out the other variant(s).
vi...@google.com <vi...@google.com> #7
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
ke...@gmail.com <ke...@gmail.com> #8
Thank you!
Description
I'm trying to create my own alarm app because I accidentally disable the alarm when it goes off in my sleep. But when I tried to create the most crucial part of the alarm app, I couldn't get it to work. I posted my question on stackoverflow and reddit and nobody has an answer how to show an
Activity
when the alarmManager triggers. The only option someone suggested was to lower the target sdk, but I'd rather have the newest target sdk and upload it to the Play Store. I also looked into the code for the Clock app (unfortunately couldn't find the one used for WearOS, so this is code for the phone).For starters, I asked for the notification permission, so notifications can be shown. I also checked
alarmManager.canScheduleExactAlarms()
, but I think this is always accepted, at least I never got to see a screen for it.The code I'm using to set an alarm is this:
AlarmBroadcastReceiver:
AlarmService:
This is the code I tried which includes
.setFullScreenIntent(pendingIntent, true)
on the notification, because this seemed to me the way to show the alarm screen (the Clock app also uses this). But couldn't get it to work. It shows the notification and I can get logging showing theService
is working, but noActivity
is shown.So after that I tried to pass a
PendingIntent.getActivity
like this:This only works when the app is in the foreground. But when you are sleeping, the app won't be in the foreground (screen will most likely be off).
I also tried to just start the
Activity
from theAlarmBroadcastReceiver
, because I didn't know what else to try, but that of course doesn't work.Sorry for the long post. But it seems to me that there is no way to open an
Activity
after theAlarmManager
triggers.