Skip to content
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

Closed
TristanWYL opened this issue Jul 2, 2020 · 46 comments
Closed

'showDailyAtTime()' dose not work as expected #693

TristanWYL opened this issue Jul 2, 2020 · 46 comments

Comments

@TristanWYL
Copy link

Describe the bug
The follwoing phenomena occur on android phones and I am not sure whether they would occur on iOS phones or not.

  1. 'showDailyAtTime()' dose not work as expected, which should have pushed the notification at a specific time but failed;
  2. Two apps invoking this plugin and running on a same Android phone seems tending to push notifications at the same time using 'showDailyAtTime()';
  3. Very often, when pushing notifications, more than 1 notifications are pushed at the same time with 'showDailyAtTime()';

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

Thanks for your reply. Regarding the example issue, I cloned the entire repository from github and it is most updated.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

I can't reproduce this myself and haven't heard anyone else report the same issue either. What do get when you run flutter doctor -v? I wonder if one of the SDKs you have installed is having an issue (e.g. corrupt) and needs reinstalling. Perhaps worth using a CI/CD service to build the example and see if it works

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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?

@TristanWYL
Copy link
Author

flutter doctor for your reference. I will try to use CI/CD service to dig out something.

[√] Flutter (Channel unknown, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.900], locale en-US)
• Flutter version 1.12.13+hotfix.9 at C:\flutter
• Framework revision f139b11009 (3 months ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Android
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 42.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code, 64-bit edition (version 1.44.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.11.0

[√] Connected device (1 available)
• SM A9000 • 862dea94 • android-arm64 • Android 6.0.1 (API 23)

• No issues found!

@TristanWYL
Copy link
Author

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.

Running "flutter pub get" in example... 10.8s
Launching lib\main.dart on SM A9000 in debug mode...
Running Gradle task 'assembleDebug'...
C:\flutter.pub-cache\hosted\pub.dartlang.org\e2e-0.2.4+4\android\src\main\java\dev\flutter\plugins\e2e\E2EPlugin.java:35: warning: [deprecation] getFlutterEngine() in FlutterPluginBinding has been deprecated
binding.getApplicationContext(), binding.getFlutterEngine().getDartExecutor());
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\e2e-0.2.4+4\android\src\main\java\dev\flutter\plugins\e2e\FlutterRunner.java:32: warning: [unchecked] unchecked cast
ActivityTestRule rule = (ActivityTestRule) field.get(instance);
^
required: ActivityTestRule
found: Object
2 warnings
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
D/FlutterActivity(22723): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(22723): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(22723): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
W/FlutterEngine(22723): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@89b8d9c) but could not find and invoke the GeneratedPluginRegistrant.
D/FlutterActivityAndFragmentDelegate(22723): Attaching FlutterEngine to the Activity that owns this Fragment.
Syncing files to device SM A9000...

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

The following is the output of logcat when it crashes for your reference.

07-02 10:53:43.313 23548 23548 E Zygote  : v2
07-02 10:53:43.313 23548 23548 W SELinux : Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0035
07-02 10:53:43.313 23548 23548 E Zygote  : accessInfo : 0
07-02 10:53:43.313 23548 23548 W SELinux : SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=com.dexterous.flutterlocalnotificationsexample
07-02 10:53:43.503 23548 23548 W FlutterEngine: Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@2e831e9) but could not find and invoke the GeneratedPluginRegistrant.
07-02 10:53:43.503 23548 23548 E AndroidRuntime: FATAL EXCEPTION: main
07-02 10:53:43.503 23548 23548 E AndroidRuntime: Process: com.dexterous.flutterlocalnotificationsexample, PID: 23548
07-02 10:53:43.503 23548 23548 E AndroidRuntime: java.lang.NoClassDefFoundError: dev.flutter.plugins.e2e.E2EPlugin
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:15)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at com.dexterous.flutterlocalnotificationsexample.MainActivity.configureFlutterEngine(MainActivity.java:27)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:185)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:418)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:6877)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.ActivityThread.access$1100(ActivityThread.java:223)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7224)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
07-02 10:53:43.503 23548 23548 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-02 10:53:43.503  1267  2277 W ActivityManager:   Force finishing activity com.dexterous.flutterlocalnotificationsexample/.MainActivity
07-02 10:53:43.533 10662 10662 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1313 android.content.ContextWrapper.startService:606 android.content.ContextWrapper.startService:606 com.samsung.andr
oid.sm.common.SmartManagerReceiver.b:259 com.samsung.android.sm.common.SmartManagerReceiver.onReceive:107
07-02 10:53:43.533  1267 23579 E android.os.Debug: ro.product_ship = true
07-02 10:53:43.533  1267 23579 E android.os.Debug: ro.debug_level = 0x4f4c
07-02 10:53:43.533  1267 23579 E android.os.Debug: sys.mobilecare.preload = false
07-02 10:53:43.593  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:53:43.603  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:53:43.603  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:53:43.603  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:53:43.603  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:53:44.023  1267  1296 W ActivityManager: Activity pause timeout for ActivityRecord{52382b5 u0 com.dexterous.flutterlocalnotificationsexample/.MainActivity t691 f}
07-02 10:53:46.303  1267  2257 W System.err: remove failed: ENOENT (No such file or directory) : /data/system/recent_tasks/691_task.xml.bak
07-02 10:53:53.193  8935  8935 E SPPClientService: [[PushClientService]] reqType : 0
07-02 10:53:53.203  8935  8935 E SPPClientService: [[PushClientService]] F:false, D:false, E:false, T:false, S:false, R:false
07-02 10:53:54.083  1267  1296 W ActivityManager: Activity destroy timeout for ActivityRecord{52382b5 u0 com.dexterous.flutterlocalnotificationsexample/.MainActivity t691 f}
07-02 10:54:06.943  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-02 10:54:07.013  1267  1298 E ViewRootImpl: sendUserActionEvent() mView == null
07-02 10:54:07.013  1267  3181 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@8f283ba attribute=null, token = android.os.BinderProxy@24546c6
07-02 10:54:07.103  1267  2276 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:836 com.android.server.am.ActivityManagerService.updateOomAdjLocked:26984 com.android.server.am.ActivityManagerServi
ce.appDiedLocked:7644 com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied:1922 android.os.BinderProxy.sendDeathNotice:558
07-02 10:54:1
```0.073  1267  2550 E Watchdog: !@Sync 9124 [07-02 10:54:10.087]

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

I just upgraded the flutter SDK to Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.900], locale en-US) and ran the example again but did not have luck. Moving the folder to offer a short path did not help as well.

@TristanWYL
Copy link
Author

But other flutter apps can run normally with this environment. It does not make sense if it is about the environment.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

Thanks. Given what you've written though, did you have the same issue running the example app on devices higher than API 24?

@TristanWYL
Copy link
Author

No. The example APP can run normally on devices higher than API 24 as I tried.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

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?

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

Is there a reason why your example schedules a notification using a date from about 20 years ago?

@TristanWYL
Copy link
Author

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?

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

Yeah it doesn't matter just looked odd so was curious

@TristanWYL
Copy link
Author

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

You mentioned you're expecting notifications every minute but the method showDailyAtTime you called is for showing notifications daily at a particularly time

@TristanWYL
Copy link
Author

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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.

Please explain how your code is stating it is requesting a notification to be shown every minute

@TristanWYL
Copy link
Author

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.

for (var i = 0; i < 24*4; i++) {
      _idNotification++;
      _dt = _dt.add(Duration(minutes: 1));
      print("Notification ID: $_idNotification Time Setting: ${_dt.hour}:${_dt.minute}:${_dt.second}");
      await _myShowDailyAtTime(
          time: Time(_dt.hour, _dt.minute, _dt.second),
          id: _idNotification,
          title: "TESTING TITLE",
          body: "TESTING BODY",
//            title: AppLocalizations.of(context).surveyMorning,
//            body: AppLocalizations.of(context).surveyMorningDesc.replaceFirst(
//                "@number", Global().qNumOfFirstSession.length.toString()),
          payload: "good morning");
    }

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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 print("Notification ID: $_idNotification Time Setting: ${_dt.hour}:${_dt.minute}:${_dt.second}"); then you should've seen what times those notifications will roughly appear

@TristanWYL
Copy link
Author

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?

@TristanWYL
Copy link
Author

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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.

I use 24 by 6

Where is the 6 from?

@TristanWYL
Copy link
Author

Where is the 6 from?

Typo: should be 4
I totally understand your reply. Actually my true use case of your plugin is to push a notification every 15 minutes within a period of time in one day, and do the same thing each day. This is why I schedule a couple of daily notifications. The plugin used to work pretty good and the notification scheduled in this way can appear almost at the specified time. I of course understand the word roughly, but what is the extent of the roughness? My app can tolerate a inaccuracy of a couple of minutes, but sometimes the delay can go up to tens of minutes. Besides, some times the notifications are not pushed one by one, rather that a couple of them came out at the same time. Please refer to the following screenshot. I do not know does this happen on your phone.
Screenshot_20200702-173135

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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 zonedSchedule method that will schedule notification to appear on a particular date and time relative to a timezone. An optional argument is available for specifying the frequency (e.g. daily) and an argument (androidAllowWhileIdle) on if the notification show be shown at a precise time. If a precise time is requested, recurring notifications work by scheduling a single a notification first and once it appears, the next one is scheduled.

@TristanWYL
Copy link
Author

I will give a try. Thanks so much for your effort to help me.

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

No worries, thanks for finding the post about the e2e issue as well. I've asked in that thread if the Flutter team could make it clearer in their changelog that they fixed a crash

@TristanWYL
Copy link
Author

When I ran the example app of 1.5.0 beta, some issues occured. Do you have any idea why this happened?

E/MethodChannel#dexterous.com/flutter/local_notifications(10492): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at org.threeten.bp.zone.ZoneRulesProvider.getProvider(ZoneRulesProvider.java:165)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at org.threeten.bp.zone.ZoneRulesProvider.getRules(ZoneRulesProvider.java:122)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at org.threeten.bp.ZoneRegion.ofId(ZoneRegion.java:143)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at org.threeten.bp.ZoneId.of(ZoneId.java:358)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedScheduleNotification(FlutterLocalNotificationsPlugin.java:292)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedSchedule(FlutterLocalNotificationsPlugin.java:914)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:841)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at android.os.Looper.loop(Looper.java:135)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at android.app.ActivityThread.main(ActivityThread.java:7224)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
E/MethodChannel#dexterous.com/flutter/local_notifications(10492): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
E/flutter (10492): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, No time-zone data files registered, null)
E/flutter (10492): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (10492): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (10492):
E/flutter (10492): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (10492): #3 AndroidFlutterLocalNotificationsPlugin.zonedSchedule (package:flutter_local_notifications/src/platform_flutter_local_notifications.dart:131:20)

@MaikuB
Copy link
Owner

MaikuB commented Jul 2, 2020

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

@TristanWYL
Copy link
Author

Thanks, the 1.5.0-beta.4 fixed this bug. Some other feedbacks you may want to know are that :

  1. I tested the new beta version on my old Samsung phone, which shows that a maximum of 50 notifications can be pushed if the number of scheduled notifications is over 50.
  2. After I close the APP manually, an alert dialog will be popped up when next notification is pushed and indicates that flutter_local_notifications_example crashes;

@MaikuB
Copy link
Owner

MaikuB commented Jul 3, 2020

  1. I tested the new beta version on my old Samsung phone, which shows that a maximum of 50 notifications can be pushed if the number of scheduled notifications is over 50.

This is a Samsung issue/limitation, though from memory I heard it's 500.

  1. After I close the APP manually, an alert dialog will be popped up when next notification is pushed and indicates that flutter_local_notifications_example crashes;

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

@TristanWYL
Copy link
Author

For the recording, please refer to this link.

07-03 16:24:29.005 32522 32522 E Zygote  : v2
07-03 16:24:29.015 32522 32522 W SELinux : Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0035
07-03 16:24:29.015 32522 32522 E Zygote  : accessInfo : 0
07-03 16:24:29.015 32522 32522 W SELinux : SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=com.dexterous.flutterlocalnotificationsexample
07-03 16:24:29.285 32522 32522 W         : Unable to open '/system/framework/qcom.fmradio.jar': No such file or directory
07-03 16:24:29.285 32522 32522 W art     : Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error
07-03 16:24:29.295 32522 32522 E AndroidRuntime: FATAL EXCEPTION: main
07-03 16:24:29.295 32522 32522 E AndroidRuntime: Process: com.dexterous.flutterlocalnotificationsexample, PID: 32522
07-03 16:24:29.295 32522 32522 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: f.a.a.x.g: No time-zone data files registered
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3642)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.app.ActivityThread.access$2000(ActivityThread.java:223)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7224)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-03 16:24:29.295 32522 32522 E AndroidRuntime: Caused by: f.a.a.x.g: No time-zone data files registered
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at f.a.a.x.i.a(:1)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at f.a.a.r.a()
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at f.a.a.p.a()
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedScheduleNotification()
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedScheduleNextNotification()
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(:2)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3635)
07-03 16:24:29.295 32522 32522 E AndroidRuntime:        ... 8 more
07-03 16:24:29.295  1267 32537 E android.os.Debug: ro.product_ship = true
07-03 16:24:29.295  1267 32537 E android.os.Debug: ro.debug_level = 0x4f4c
07-03 16:24:29.295  1267 32537 E android.os.Debug: sys.mobilecare.preload = false
07-03 16:24:29.335 31672 31672 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1313 android.content.ContextWrapper.startService:606 android.content.ContextWrapper.startService:606 com.samsung.andr
oid.sm.common.SmartManagerReceiver.b:259 com.samsung.android.sm.common.SmartManagerReceiver.onReceive:107
07-03 16:24:29.395  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-03 16:24:29.405  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-03 16:24:29.405  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-03 16:24:29.405  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-03 16:24:29.415  1267  1835 E libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
07-03 16:24:34.635  2442  2476 E ContactsProvider_EventLog: Flush buffer to file cnt : 16 size : 6Kb duration : 262ms lastUpdatedAfter : 60093 ms mFlush_time_threasold : 2000 mCurrentSize : 3472


@MaikuB
Copy link
Owner

MaikuB commented Jul 3, 2020

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 :(

@TristanWYL
Copy link
Author

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.

@MaikuB
Copy link
Owner

MaikuB commented Jul 3, 2020

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

@TristanWYL
Copy link
Author

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?

@MaikuB
Copy link
Owner

MaikuB commented Jul 3, 2020

No, as using DateTime is what has led to issues with daylight savings. It also limits what can be done as DateTime as it either UTC or local

@TristanWYL
Copy link
Author

I see. Thanks for clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants