-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'showDailyAtTime()' dose not work as expected #693
Comments
You mentioned you ran the example app but did you download/clone the entire repository or only copied part of the code? The example will not work if the way you tried to get it running was to copy the code and this was documented. So far what you've written says that issues occurred after steps you had done. Unless you can provide steps to reproduce this via the example app (bearing in mind what I said earlier) or provide a minimal app to reproduce. This can't be investigated further as nothing so far indicates that this is a bug with the plugin as it could well be an issue with your own app |
Thanks for your reply. Regarding the example issue, I cloned the entire repository from github and it is most updated. |
I can't reproduce this myself and haven't heard anyone else report the same issue either. What do get when you run |
Another question I forgot to ask is after you cloned the repository, did you do anything else before you ran the example? I'm asking this because there are some known issues on using Android gradle plugin 4+ with Flutter itself. Also, what steps did you take to run the example and what did you run the example app on? |
|
I simply cloned the repository and ran the example directly without doing anything else. I tried to run the example with "flutter run --release" and "flutter run --debug" and neither could work. Just tried again by cloning the repository and run the example with "flutter run --release" but no luck. When running the example I got the output from the "Run" window and I pasted it here for your reference.
|
Thanks don't see any errors mentioned there. If you haven't already, I'd suggest you use logcat to see what it says when it crashes |
The following is the output of logcat when it crashes for your reference.
|
Looks like Flutter itself is having issues finding another plugin. Not something I can help with there as that's an issue specific to your environment. Don't know where you have Flutter installed but perhaps it should be moved in case the issue is to do with windows having issues with the length of file paths. |
To add to this, I think you may need someone to help solve issues with your environment and I don't build/run Flutter apps on Windows. Perhaps make use of one of the sites at https://flutter.dev/community, Discord, Slack etc to find help on that. Part of the CI process for the plugin is to actually run the example app on a Linux VM and that is working/passing |
I just upgraded the flutter SDK to |
But other flutter apps can run normally with this environment. It does not make sense if it is about the environment. |
That you can run other apps on it doesn't mean you don't have an issue as they can have different dependencies. For example, it could be your pub cache is partially corrupt given the example app is crashing for another plugin. If you haven't already you can try cleaning/repairing your pub cache but your problem isn't something I can help with |
Just for your information only, this post fixes the crashing issue as you used e2e plugin in the example APP, which can only run on devices with an API level greater than 24. |
Thanks. Given what you've written though, did you have the same issue running the example app on devices higher than API 24? |
No. The example APP can run normally on devices higher than API 24 as I tried. |
I do have a 1.5.0 beta release on pub that uses a more recent version of the e2e plugin though it isn't the latest. You mind trying that out to see if that solves the issue? I might consider a 1.4.5 release that will bump the version together with #691 when that lands Edit: I did originally try to see if e2e was the culprit but the changelog never mentioned that it fixes an issue like the one you linked |
Changing nothing but the e2e version in pubspec.yaml file to '0.6.0' can fix this as well. Probably the flutter team has fixed this. In addition, I made a toy example based on your example code, by which the captioned issue can be reproduced. Would you be able to help have a look at the code? |
Is there a reason why your example schedules a notification using a date from about 20 years ago? |
We should not care about the year/month/day right? We are only caring about the hour/minute/second as we will only schedule the daily notification, right? |
Yeah it doesn't matter just looked odd so was curious |
HAHA, no problem. So based on my modification on your code, why does not the app work as expected, which should be pushing a notification every minute. Previously I set the interval as 15 minutes but it still did not work. |
You mentioned you're expecting notifications every minute but the method |
According to the code I committed, we should be able to see a new notification pushed every minute. True, it is scheduled by a daily method at a particular time, but the particular times are well designed and the interval among them are 1 minute. So the notification should be pushed every minute TODAY, and TOMMORROW and so on for following days. |
I've tweaked your example so i could get the next batch of notifications in my local time and they appeared as expected and based on my previous testing with the method, I would expect the next instance a notification with a particular id to appear the next day. Doesn't look like there's an issue here but based on what you written, it sounds like you've misunderstood how frequent the notifications are meant to appear when it's named and documented to show on a daily interval |
Please explain how your code is stating it is requesting a notification to be shown every minute |
The below code quoted from the committed project can set 24 by 4 notifications among which the interval is 1 minute, even though each notification is set to run daily. So based on these codes, my phone will expect to push a notification every minute. Am I mis-stating something? as I think this is straightforward.
|
24 by 4 is 96 (note: I don't know why you have this calculation), so you are requesting daily notifications for a 95 minute time range of the day i.e. there'll be 95 daily notifications. If you looked at the console to see what actually gets printed from calling |
Yes, you are right. It is a 95 minutes time range among which the notification will be pushed minutely. So based on this, should not the notification occur minutely? |
I use 24 by 6 just for covering a whole day as I set the interval as 15 minutes previously, but it will cost 15 minutes to wait for a notification. 15 minutes are too long, so I change it to 1 minute. |
There will be notifications will appear roughly one minute after each other but they will only repeat on a daily basis. In other words, for a given day, there'll be 95 notifications that will be appear about one minute apart. They will not repeat every minute. I've highlighted roughly as it's up to Android to decide when they'll appear so it won't be exact as per the caveat mentioned in the readme here. If you were expecting notifications to repeat every minute, every day then you need to fix your code to match what you're trying to do.
Where is the 6 from? |
It's up to Android to decide so I can't give you any range as it's part of Android's battery optimisation process so could be quite random. It might shift a bunch of time to occur together. I would suggest you give the 1.5.0 beta a go. The method you're using now has been deprecated in favour of adding a |
I will give a try. Thanks so much for your effort to help me. |
No worries, thanks for finding the post about the |
When I ran the example app of 1.5.0 beta, some issues occured. Do you have any idea why this happened?
|
Looks like I missed a step when I reverted back to using another library on Android for timezone-based scheduling. Should be fixed now in 1.5.0-beta.4 |
Thanks, the 1.5.0-beta.4 fixed this bug. Some other feedbacks you may want to know are that :
|
This is a Samsung issue/limitation, though from memory I heard it's 500.
Would you be able to share a recording and uploading it as video on YouTube or using a site that converts a video to a gif? Logs would also help |
For the recording, please refer to this link.
|
Thanks I'll take a look. I'm beginning to wonder anyone else has been helping to beta test given no one else has helped report issues, which is a bit concerning :( |
Perhaps they have not encountered any bugs. Btw, when will you release the 1.5.0 version? After you release it formally, more people will use it and probably there will be more bug reports. |
Haven't thought about a release timing yet. Part of the reason for making it a beta release was to get feedback on the changes for scheduling a timezone. The plugin is using another Android library at the moment for backwards compatibility on older Android versions. The crashes you're seeing relate to needing to initialise that library. If flutter/flutter#58247 gets solved then that dependency could be removed, that way only the native Java time APIs need to be used. Was hoping to give it some time to see if it gets solved |
When I tried to use the beta version, TZDatetime is not so straightforward as Datetime (corresponding to that of the OS). Will you consider add an option for the developer to decide which type of the Datetime will be used? |
No, as using |
I see. Thanks for clarification. |
Describe the bug
The follwoing phenomena occur on android phones and I am not sure whether they would occur on iOS phones or not.
These issues have nothing to do with the phone model, as I have tried on different phones. In addition, I do not know why the built-in example code of "flutter_local_notifications" cannot work, as every time I lauched the App, it crashes and prompted "flutter_local_notifications_example 已停止。"
To Reproduce
This plugin used to work normally, but after I did some things like: upgrading the flutter SDK and tweaking the codes in gradle file to suite the new SDK and updated plugins, these bugs appeared. I tried to rewind everything to somewhere the code can work normally, which includes getting back the old flutter SDK version and the gitted code, but all failed.
What do I need
If possible, please simply give me some clues why these phenomena happens. Thanks so much for your help.
The text was updated successfully, but these errors were encountered: