gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

Package makes the app bypass the phone's lock screen #224

Open sidali-dev opened 3 months ago

sidali-dev commented 3 months ago

version 3.1.4

First of all i would like to thank you for the package, it is really helpful and easy to use.

Basically whenever i try to lock my screen while in the app and unlock it back again, the app bypasses the phones lock, now i know this is a result of setting these 2 in the android manifest file to true, so the alarm would display normally: android:showWhenLocked="true" android:turnScreenOn="true"* but it has created this side effect where now all the app bypasses the phone lock.

I expected to find other people mentioning this but it appears am the only one here, i have tried to use different devices and the problem is still occurring.

I have tried using a Pixel 7 and an Honor 7x and a OnePlus Nord N20, with the same result, though i haven't really try to test on any emulators or IOS devices.

The Only possible fix i can think of due to my small experience in native android, is to create a new activity that is dedicated to showing the alarm screen, and setting the needed attributes up in it. this way we can definitively separate the unwanted attributes from the main activity, though i have never tried to build a flutter app with 2 activities and what possible effects it could cause.

gdelataillade commented 3 months ago

Thank you for your interest in the plugin and for the detailed feedback!

I haven’t encountered this issue before, and your insights are very helpful. Could you please provide a step-by-step guide on how to reproduce this problem? This will help me better understand the issue and potentially find a solution.

I also don’t have extensive experience with native Android development. If you feel comfortable contributing and submitting a PR with a fix, that would be greatly appreciated. Otherwise, I’ll add this to my to-do list, but please note that it may take some time to address as I have several other issues to manage first.

Thank you for your understanding and support!

sidali-dev commented 3 months ago

the behaviour am facing isn't directly related to your package, it is a side effect of using android:showWhenLocked="true" and having flutter run on a single activity, if you want to reproduce the bug just try to lock the phone while still inside and app, that uses the previously mentioned attributes, or basically using ur package (since it relies on that attribute along with others), once you try to turn your phone back on you will be faced with the app directly, thus bypassing the lock screen. also i would love to contribute to this project, but fair warning i havent used native for a while and ive never done something like this, so if you can help me get into it than ill be more then happy to lend a hand.