jd1378 / otphelper

open-source application that can copy OTP and codes from notifications automatically for you
GNU Affero General Public License v3.0
356 stars 31 forks source link

重启开机后,无法自动复制 #77

Closed ttbamov closed 1 month ago

ttbamov commented 2 months ago

手机型号锤子R2 情况:用的是1.11版本。手机重启后,必须在权限管理中将第二条的”允许读取通知”→“前往设置”→“通知读取权限”【重新关闭并打开】才能恢复自动复制。【希望大佬优化重启后不必重新开启权限】

其次问题是:建议大佬优化开机重启后的保活设置

谢谢大佬的辛苦付出 期待软件越来越好

jd1378 commented 2 months ago

Hi this is a bug, because it doesn't happen on all phones I have Xiaomi and it works fine after restarts I wonder if there's a fix that can help issue with notification permission, because the problem is with the permission , not the app being killed

ttbamov commented 2 months ago

你说的没错,问题是出在权限,如果能增加一项权限获取:打开无障碍服务。是否可行呢?因为我有很多软件也是通过打开无障碍,并关闭电池优化,便能做到在重新启动后自动启动。 其次是增加“钉在通知栏”功能,应该也会增加其自动启动的效果

You are right, the problem is access, if you can add a access access: open accessible services. Is it possible? Because I have a lot of software is also open barrier-free, and turn off battery optimization, can be achieved after reboot automatically start. The second is the addition of the“Pin in the notification bar” feature, which should also increase the effect of its auto-start

Screenshot_20240429192842 Screenshot_20240429192856 这是参考。一种软件他得获得这些权限 This is for reference. A software that he needs to obtain these permissions

ttbamov commented 2 months ago

You are right, the problem is access, if you can add a access: open accessible services. Is it possible? Because I have a lot of software is also open barrier-free, and turn off battery optimization, can be achieved after reboot automatically start. The second is the addition of the“Pin in the notification bar” feature, which should also increase the effect of its auto-start

jd1378 commented 1 month ago

the permission problem is a bug in android in some devices, and it's specific to notification read permission whats your android version ?

ttbamov commented 1 month ago

我的手机操作系统是“smartisan os” 安卓版本是android 11 My mobile operating system is "Smartisan OS" Android version is Android 11 Screenshot_2024-05-10-14-41-12-173_设置

jd1378 commented 1 month ago

thanks for the info

I try to implement a check on startup (when phone reboots) to check if the app still has the permission to read notifications, if it doesn't have, tell the user to disable and enable the permission again

this should help you to know when the app is not working as expected after restart

ttbamov commented 1 month ago

Thank you for your efforts

I see others have similar problems as well

This may occur on some phones, and it is indeed a rather troublesome issue. The "push" and "permission" functions on Android phones have always been a big problem, because many software, even if set to start automatically, sometimes cannot be implemented. And software that obtains many permissions will automatically call location or record in the background, leading to increased power consumption.

If there is such a startup check, it would also be helpful. After checking, you can notify on the notification bar. Click in to open it directly.

Now I try my best to ensure that my phone doesn't shut down, because it lacks a sense of security and you don't know which software won't start automatically. This is a troublesome matter

jd1378 commented 1 month ago

If there is such a startup check, it would also be helpful. After checking, you can notify on the notification bar. Click in to open it directly.

I have added this startup check and a notification will be shown if the permission is not working

this will be released soon as 1.15.0

please let me know if the notification did not work

ttbamov commented 1 month ago

谢谢,感谢你们的倾听 Thank you. Thank you for listening

jd1378 commented 1 month ago

can you please try 1.15.1 and let me know if it fixes the issue ? it contains an important fix you can download it directly from github releases if you have f-droid version

ttbamov commented 1 month ago

Text description may not be clear enough, read the attached picture content I downloaded 1.15.1. , rebooted the phone, the situation emerged:

  1. After rebooting, the text message verification code received can not be copied directly automatically, meaning that the software is not running in the background
  2. I click send Test Notification, and a notification appears in the notification bar. But clicking on the notification has no effect. Obviously clicking on it does not activate the copy function of the software
  3. I have to click on permission management and turn on"Notification read permission" again before the software can resume automatic replication
  4. When the automatic copy is restored and the copy is successful, a new notification appears on the notification bar

绘图1(2)

jd1378 commented 1 month ago

Does your phone have a autostart settings ? I suspect it might have one and you need to allow the app to start automatically

For example on my xiaomi phone it's under "Security -> Background autostart", I have to add my app there to be able to launch on restarts

ttbamov commented 1 month ago

Yes, I've opened them all. This software can open the permissions I have all opened But there are differences in the settings of Android phones. PixPin_2024-05-13_22-17-01

ttbamov commented 1 month ago

There is very little software that can boot itself

Because they require a lot of permissions

Some of the things I think are very important:

  1. No barriers. Accessible.This permission needs to be opened. This is very important. Because of my software, some software is because of this permission, so can really do has been running in the background, reboot can also be self-starting. If you are using the English version I am not sure if you really understand this setting because of the difference in translation

Battery optimization must be turned off

Pin the app to the background so it can't be killed

Finally, you need to open as many of the applications as possible

Even so, some software may not be able to do it

I think we need more permissions for this software.

jd1378 commented 1 month ago

Hi In the screenshot you have sent above, application self-start permission is exactly what I was asking If it's enabled, then app should not have any problem with starting itself If theres still a problem, then it's probably a bug In phones that are more popular in rest of the world, like xiaomi, i show the button to user to open the autostart settings, but there are so many brands that I can't support them all

From what it seems, the only thing i can do about this is to always show a notification to open settings on android 10 and 11 regardless of permission status

jd1378 commented 1 month ago

done in v1.15.2

ttbamov commented 1 month ago

Yes, this feature was implemented in version 1.15.2 Screenshot_20240517011941

Thank you for your hard work and dedication This makes me more efficient when I use my cell phone I'm obsessed with efficiency Hopefully, the software will continue to live in the background of the phone and never be killed, whether it is rebooted or turned on Expect software to get better and better