Transform into full clock app #36
Replies: 14 comments 16 replies
-
Thank you for your interest in this app!
In principle, yes. But it will be a long project where I will have to completely rebuild the main activity (that shows the list of alarms). My first priority is to deal with some important bugs. Once that is done, I will consider your suggestion.
You mean when the device is switched off? Unfortunately, that is not possible, because when the device switches off, the OS itself shuts down, so no software can run on it. In fact, no app can work when the device is switched off, even with root permissions. |
Beta Was this translation helpful? Give feedback.
-
Yes i mean when the phone is off. For phones with snapdragon there is power off alarm, with the following permission org.codeaurora.permission.POWER_OFF_ALARM. If you extract the apk of this rom and install it on any phone with snapdragon without root (except xiaomi, Miui rom's fault) the alarm will work when the phone is off. If you want, I'll send you the apk if you have a snapdragon phone. It is a feature of the snapdragon processor |
Beta Was this translation helpful? Give feedback.
-
Ok I'll send you the apk, however, make sure you give permission as in the video. Then set the alarm after at least 15 minutes. Then turn off the phone, and the phone should turn on again 1 minute before you set the alarm. Then after the phone stays on. This apk was extracted from a pie rom. https://drive.google.com/file/d/1QxWf4Zzmd-f0salDvpgDk1tRcb-Xp47N/view?usp=drivesdk let me know if it works https://github.com/Havoc-OS/android_packages_apps_DeskClock/search?q=power+off+alarm IMG_0038.MP4 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the apk. I installed it on my device, and the moment I opened it, the app crashed. I believe my device does not support power off alarms even though it has the snapdragon processor — probably prohibited by the firmware.
This link was particularly helpful in finding the exact location of the code. That ROM is sending a broadcast to a qualcomm package to set the power off alarm: private static final String ACTION_SET_POWEROFF_ALARM =
"org.codeaurora.poweroffalarm.action.SET_ALARM";
private static final String ACTION_CANCEL_POWEROFF_ALARM =
"org.codeaurora.poweroffalarm.action.CANCEL_ALARM";
private static final String POWER_OFF_ALARM_PACKAGE =
"com.qualcomm.qti.poweroffalarm";
private static final String TIME = "time";
...
private static void setPowerOffAlarm(Context context, AlarmInstance instance) {
LogUtils.i("Set next power off alarm : instance id "+ instance.mId);
Intent intent = new Intent(ACTION_SET_POWEROFF_ALARM);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.setPackage(POWER_OFF_ALARM_PACKAGE);
intent.putExtra(TIME, instance.getAlarmTime().getTimeInMillis());
context.sendBroadcast(intent);
} It's pretty easy to implement this, but I need to be sure that ROMs from different manufacturers (that support power off alarm) are doing it the same way. |
Beta Was this translation helpful? Give feedback.
-
I uninstalled the app, then I installed this test apk. You're on the right track, I'm sure you can make it work. |
Beta Was this translation helpful? Give feedback.
-
however, the alarm does not work even with the phone on, here for you another log |
Beta Was this translation helpful? Give feedback.
-
I changed some things, but I also tested the changes thoroughly before
publishing the update. The error you have reported is really odd because it
says that the app is denied a permission that I never requested in the
first place.
…On 6 Jan 2021 4:00 a.m., "qw123wh" ***@***.***> wrote:
however, in the stable version prior to 1.3.3 I didn't have any kind of
problem, it is something you changed in version 1.3.4 that causes the error
on my phone.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#36 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANQ3XBBNB2ILSBE3EGOWELLSYOHH7ANCNFSM4VRJZFWA>
.
|
Beta Was this translation helpful? Give feedback.
-
try doing a test apk with that permission and see if it works, or there is some other problem at the source. I know it is a very strange permission to access the phone and also risky, but let's try. But for safety in the trial apk remove internet access, so at least access to the read privileged phone state is more secure |
Beta Was this translation helpful? Give feedback.
-
Till now, I haven't got any crash reports regarding this from Google Play. Keeping fingers crossed. For the while, unfortunately, I have decided to discontinue work on this power off alarm feature. While I agree that it is not impossible to implement this feature, it is certainly more tiresome to design something that works on only some types of devices/ROMs. Some manufacturers enable this feature in the stock ROM itself, but I spoke to some developers last night, and they said that the permission is reserved only for system apps. Custom ROMs are probably more lenient and allow third-party apps to access the permission, but there are hundreds of custom ROMs out there, and something that works on one may not work on another. If you still face that error after updating to the latest stable version, try uninstalling the app and rebooting the device, and then install it again. If someone, in the future, implements this feature and opens a PR, I will be happy to test it and merge it. |
Beta Was this translation helpful? Give feedback.
-
I don't know what happened anyway I performed a reset on the phone I reinstalled the rom, and now that problem gives me even with version 1.3.3 downloaded from github. I really don't know where the problem lies because now even the official versions don't work for me even the old versions. |
Beta Was this translation helpful? Give feedback.
-
Good news. The bug has been fixed, I tried this experiment on previous versions app as well, including the two test versions with power off alarm. Basically the bug is caused by the alarm ringtone, if I do not touch anything and I remain all by default the alarm does not sound, it crashes and always gives me the same error on the log. If I magically change the alarm ringtone, the alarm rings, the app no longer crashes. Sounds strange but all the fuss is caused by the ringtone. However I was convinced that power off alarm, and that the custom rom were not the problem of the bug and I was right. I don't know if you can change something on the ringtone otherwise I will always use this trick and everything will work. |
Beta Was this translation helpful? Give feedback.
-
anyway i found another bug, i have to try it on other phones too, maybe it's always my phone's fault. Basically, if I set an alarm and then turn off and on again or restart the phone, when the alarm sounds, I can't turn it off with the power button, but only with a shake. And from that moment on I can no longer turn it off with the power button. I have to uninstall and reinstall the app to make it work. |
Beta Was this translation helpful? Give feedback.
-
As far as power off alarm is concerned, I know that you no longer want to hear about it anyway with the ringer trick I told you earlier and in the test versions I received this other error https://del.dog/ickexethem.txt Just take a look at it, maybe it can be used for something else. However, I found the way to make the alarm go off when it was off thanks to you with your app |
Beta Was this translation helpful? Give feedback.
-
I tested on all the devices I had, and found that I could turn off the alarm with the power button even after a reboot. Regarding the stack trace you posted above, is that on the stable version? Note that the power-off alarm version that I gave you was in alpha stage, and may not work as intended. |
Beta Was this translation helpful? Give feedback.
-
Hi the thing I like most about your app is the ability to turn off the alarm with the power button. It would be great if this app becomes a complete app in the future, with stopwatch, timer, clock and alarm. Could you do it? Perhaps also adding power off alarm, so that the alarm sounds even when the phone is off.
Beta Was this translation helpful? Give feedback.
All reactions