GithubHelp home page GithubHelp logo

pushy / pushy-flutter Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 17.0 325 KB

The official Pushy SDK for Flutter apps.

License: Apache License 2.0

Java 45.33% Ruby 2.49% Swift 17.88% Objective-C 0.42% Dart 21.14% HTML 2.35% JavaScript 10.40%

pushy-flutter's People

Contributors

pushy avatar ryanheise avatar tylervanderhoef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pushy-flutter's Issues

Notification not work on iOS simulator.

How are you?
I tested your demo app after changing the bundle id.
I created .p8 and register it to the pushy dashboard.
but both my project and the demo are not working.
What should I do more?

Here are error log.
2021-01-05 21:09:33.226860-0800 Runner[33698:722677] flutter: Error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
2021-01-05 21:25:37.130551-0800 Runner[33698:722680] [VERBOSE-2:profiler_metrics_ios.mm(184)] Error retrieving thread information: (ipc/send) invalid destination port

Push Notification on Battery Saver Mode

I am Using OnePlus 6t and the flutter sdk for pushy works fine except when i turn on the battery saver mode. It goes into sleep and i get all the notification at once when i turn off the battery saver mode.

Is there ary way around this ? Receiving notifications while in battery saver mode ? Firebase seems to do it.

[Android] Application crashes on startup when building with last Flutter 1.12.13

Hi! We got a problem after updating to the latest version of Flutter 1.12.13, there is a crash on launch the application after successful build.

Steps to Reproduce

  1. upgrade flutter with
flutter upgrade
  1. upgrade dependences and cache
flutter pub cache repair
flutter pub upgrade
flutter pub get
  1. Build and launch any application with the Pushy SDK dependecy, pushy-demo-flutter for example
flutter clean
flutter build apk
flutter install
  1. Crash at application startup.

Logs

through Logcat

E/Pushy: Failed to invoke getFlutterView() on parent activity
    java.lang.NoSuchMethodException: getFlutterView []
        at java.lang.Class.getMethod(Class.java:1981)
        at java.lang.Class.getMethod(Class.java:1637)
        at me.pushy.sdk.flutter.g.a(:55)
        at me.pushy.sdk.flutter.g.a(:46)
        at b.a.c.a.a(:14)
        at me.pushy.example.MainActivity.onCreate(:11)
        at android.app.Activity.performCreate(Activity.java:6706)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2837)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2949)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1655)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:203)
        at android.app.ActivityThread.main(ActivityThread.java:6472)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1114)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Additional

Reproduced both for io.flutter.app.FlutterActivity and io.flutter.embedding.android.FlutterActivity

flutter doctor

[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.476], locale ru-RU)
    • Flutter version 1.12.13+hotfix.5 at D:\flutter
    • Framework revision 27321ebbad (2 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at D:\Users\Egor\AppData\AndroidSDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: D:\Program Files\Android\Android Studio\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 D:\Program Files\Android\Android Studio
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] Connected device (1 available)
    • M6T • 811HEBT623EQ8 • android-arm64 • Android 7.0 (API 24)

• No issues found!

Please check updates for using the platform_channel in the Flutter SDK, thanks!
https://github.com/flutter/flutter/tree/master/examples/platform_channel

Notifications (Clicked) feature

When will Flutter SDK support "Listen for Notifications (Clicked)" like the React Native SDK? We are looking for navigating to specific page via notification click event. Thanks.

Pushy: Error retrieving handle for Flutter callbacks

Whenever I use Pushy.setNotificationListener(backgroundNotificationListener) method,
"Pushy: Error retrieving handle for Flutter callbacks" error appears to me.

So Just in case, I changed my backgroundNotificationListener Function to just print something
But same error appears.

pushy-flutter causes crash during hot reload

E/MethodChannel#me.pushy.sdk.flutter/methods(25615): Failed to handle method call E/MethodChannel#me.pushy.sdk.flutter/methods(25615): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at me.pushy.sdk.util.PushyPersistence.getEnvironmentExternalStoragePath(PushyPersistence.java:28) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at me.pushy.sdk.util.PushyAuthentication.getDeviceCredentials(PushyAuthentication.java:27) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at me.pushy.sdk.util.PushyServiceManager.start(PushyServiceManager.java:22) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at me.pushy.sdk.Pushy.listen(Pushy.java:33) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at me.pushy.sdk.flutter.PushyPlugin.onMethodCall(PushyPlugin.java:113) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at android.os.MessageQueue.next(MessageQueue.java:336) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at android.os.Looper.loop(Looper.java:174) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at android.app.ActivityThread.main(ActivityThread.java:7695) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) E/MethodChannel#me.pushy.sdk.flutter/methods(25615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) W/Pushy (25615): Flutter app is listening for notifications E/EventChannel#me.pushy.sdk.flutter/events(25615): Failed to open event stream E/EventChannel#me.pushy.sdk.flutter/events(25615): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.app.Activity.getIntent()' on a null object reference E/EventChannel#me.pushy.sdk.flutter/events(25615): at me.pushy.sdk.flutter.PushyPlugin.onListen(PushyPlugin.java:196) E/EventChannel#me.pushy.sdk.flutter/events(25615): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:188) E/EventChannel#me.pushy.sdk.flutter/events(25615): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:167) E/EventChannel#me.pushy.sdk.flutter/events(25615): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/EventChannel#me.pushy.sdk.flutter/events(25615): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) E/EventChannel#me.pushy.sdk.flutter/events(25615): at android.os.MessageQueue.nativePollOnce(Native Method) E/EventChannel#me.pushy.sdk.flutter/events(25615): at android.os.MessageQueue.next(MessageQueue.java:336) E/EventChannel#me.pushy.sdk.flutter/events(25615): at android.os.Looper.loop(Looper.java:174) E/EventChannel#me.pushy.sdk.flutter/events(25615): at android.app.ActivityThread.main(ActivityThread.java:7695) E/EventChannel#me.pushy.sdk.flutter/events(25615): at java.lang.reflect.Method.invoke(Native Method) E/EventChannel#me.pushy.sdk.flutter/events(25615): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) E/EventChannel#me.pushy.sdk.flutter/events(25615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) D/Pushy (25615): Failed to request WRITE_EXTERNAL_STORAGE permission D/Pushy (25615): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference D/Pushy (25615): at me.pushy.sdk.flutter.PushyPlugin.requestStoragePermission(PushyPlugin.java:301) D/Pushy (25615): at me.pushy.sdk.flutter.PushyPlugin.onMethodCall(PushyPlugin.java:126) D/Pushy (25615): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226) D/Pushy (25615): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) D/Pushy (25615): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) D/Pushy (25615): at android.os.MessageQueue.nativePollOnce(Native Method) D/Pushy (25615): at android.os.MessageQueue.next(MessageQueue.java:336) D/Pushy (25615): at android.os.Looper.loop(Looper.java:174) D/Pushy (25615): at android.app.ActivityThread.main(ActivityThread.java:7695) D/Pushy (25615): at java.lang.reflect.Method.invoke(Native Method) D/Pushy (25615): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) D/Pushy (25615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) E/AndroidRuntime(25615): FATAL EXCEPTION: AsyncTask #2 E/AndroidRuntime(25615): Process: com.example.go_pl_hd, PID: 25615 E/AndroidRuntime(25615): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.checkCallingOrSelfPermission(java.lang.String)' on a null object reference E/AndroidRuntime(25615): at me.pushy.sdk.util.PushyPermissionVerification.verifyManifestPermissions(PushyPermissionVerification.java:26) E/AndroidRuntime(25615): at me.pushy.sdk.Pushy.register(Pushy.java:219) E/AndroidRuntime(25615): at me.pushy.sdk.flutter.PushyPlugin$1.run(PushyPlugin.java:172) E/AndroidRuntime(25615): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) E/AndroidRuntime(25615): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(25615): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(25615): at java.lang.Thread.run(Thread.java:919) I/Process (25615): Sending signal. PID: 25615 SIG: 9 Application finished.

(Android) Pushy sends keep-alive every 15 seconds after failed reconnect

We're getting an alert on Android vitals that our production app is waking up the device too frequently and draining the battery, in some cases. This was based on the 1.1.9 release of this plugin, but the 2.0.0 release is also based on the same underlying Android pushy sdk version so I assume the problem will also happen with it.

The following adb log was captured when trying to reproduce on our app in debug mode, after the app had already been running for 2 hours in the background (probably undergoing several some dozes and/or wifi disconnections):

Click to view logs

05-19 22:22:44.418 14174 14963 D Pushy   : Connection lost
05-19 22:25:35.798 14174 15972 D Pushy   : PushyJobService: Sending keep alive
05-19 22:30:45.509 14174 16318 D Pushy   : PushyJobService: Sending keep alive
05-19 22:34:05.189 14174 14956 D Pushy   : Connection lost
05-19 22:34:05.217 14174 16422 D Pushy   : PushyJobService: Connecting...
05-19 22:34:05.220 14174 16422 D Pushy   : Broker: ...
05-19 22:34:05.220 14174 16422 D Pushy   : Device Token: ...
05-19 22:34:05.220 14174 16422 D Pushy   : Device Auth Key: ...
05-19 22:34:05.257 14174 16422 D Pushy   : Connect exception:  (0) - java.net.UnknownHostException: mqtt-...
05-19 22:34:05.257 14174 16422 D Pushy   : Reconnecting in 1000ms
05-19 22:41:27.343 14174 16422 D Pushy   : PushyJobService: Connecting...
05-19 22:41:27.344 14174 16422 D Pushy   : Broker: ...
05-19 22:41:27.344 14174 16422 D Pushy   : Device Token: ...
05-19 22:41:27.344 14174 16422 D Pushy   : Device Auth Key: ...
05-19 22:41:31.588 14174 16422 D Pushy   : Connected successfully (sending keep alive every 300 seconds)
05-19 22:41:31.642 14174 16834 D Pushy   : Connection lost
05-19 22:41:31.667 14174 16841 D Pushy   : PushyJobService: Connecting...
05-19 22:41:31.667 14174 16841 D Pushy   : Broker: ...
05-19 22:41:31.667 14174 16841 D Pushy   : Device Token: ...
05-19 22:41:31.667 14174 16841 D Pushy   : Device Auth Key: ...
05-19 22:41:31.690 14174 16841 D Pushy   : Connect exception:  (0) - java.net.UnknownHostException: mqtt-...
05-19 22:41:31.690 14174 16841 D Pushy   : Reconnecting in 1000ms
05-19 22:55:39.734 14174 16422 D Pushy   : PushyJobService: Connecting...
05-19 22:55:39.734 14174 16422 D Pushy   : Broker: ...
05-19 22:55:39.734 14174 16422 D Pushy   : Device Token: ...
05-19 22:55:39.734 14174 16422 D Pushy   : Device Auth Key: ...
05-19 22:55:43.000 14174 16422 D Pushy   : Connected successfully (sending keep alive every 300 seconds)
05-19 22:55:43.058 14174 17099 D Pushy   : Connection lost
05-19 22:55:43.087 14174 17113 D Pushy   : PushyJobService: Connecting...
05-19 22:55:43.087 14174 17113 D Pushy   : Broker: ...
05-19 22:55:43.088 14174 17113 D Pushy   : Device Token: ...
05-19 22:55:43.088 14174 17113 D Pushy   : Device Auth Key: ...
05-19 22:55:43.110 14174 17113 D Pushy   : Connect exception:  (0) - java.net.UnknownHostException: mqtt-...
05-19 22:55:43.110 14174 17113 D Pushy   : Reconnecting in 1000ms
05-19 23:15:22.084 14174 17113 D Pushy   : PushyJobService: Connecting...
05-19 23:15:22.084 14174 17113 D Pushy   : Broker: ...
05-19 23:15:22.084 14174 17113 D Pushy   : Device Token: ...
05-19 23:15:22.084 14174 17113 D Pushy   : Device Auth Key: ...
05-19 23:15:26.944 14174 17113 D Pushy   : Connected successfully (sending keep alive every 300 seconds)
05-19 23:20:30.374 14174 18217 D Pushy   : PushyJobService: Sending keep alive
05-19 23:25:35.469 14174 18323 D Pushy   : PushyJobService: Sending keep alive
05-19 23:30:46.002 14174 18473 D Pushy   : PushyJobService: Sending keep alive
05-19 23:33:30.736  1681  1850 I ActivityManager: Start proc 21101:me.pushy.example/u0a391 for service {me.pushy.example/me.pushy.sdk.services.PushyJobService}
05-19 23:33:31.722 21101 21101 I e.pushy.exampl: Late-enabling -Xcheck:jni
05-19 23:33:31.887 21101 21101 I e.pushy.exampl: Unquickening 12 vdex files!
05-19 23:33:33.165 21101 21101 I TetheringManager: registerTetheringEventCallback:me.pushy.example
05-19 23:33:33.173 21101 21150 D Pushy   : PushyJobService: Connecting...
05-19 23:33:33.292 21101 21150 D Pushy   : Broker: ...
05-19 23:33:33.300 21101 21150 D Pushy   : Device Token: ...
05-19 23:33:33.301 21101 21150 D Pushy   : Device Auth Key: ...
05-19 23:33:54.396 21101 21150 D Pushy   : Connect exception:  (32000)
05-19 23:33:54.396 21101 21150 D Pushy   :  (32000)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.lib.paho.internal.Token.waitForCompletion(Token.java:112)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.lib.paho.MqttToken.waitForCompletion(MqttToken.java:67)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.lib.paho.MqttClient.connect(MqttClient.java:241)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.util.PushyMqttConnection.connect(PushyMqttConnection.java:159)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.services.PushyJobService$ConnectAsync.doInBackground(PushyJobService.java:221)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at me.pushy.sdk.services.PushyJobService$ConnectAsync.doInBackground(PushyJobService.java:203)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at android.os.AsyncTask$3.call(AsyncTask.java:394)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-19 23:33:54.396 21101 21150 D Pushy   : 	at java.lang.Thread.run(Thread.java:923)
05-19 23:33:54.397 21101 21150 D Pushy   : Reconnecting in 1000ms
05-19 23:34:26.151 21101 21150 D Pushy   : PushyJobService: Sending keep alive
05-19 23:34:41.752 21101 21846 D Pushy   : PushyJobService: Sending keep alive
05-19 23:35:00.069 21101 21846 D Pushy   : PushyJobService: Sending keep alive
05-19 23:35:15.343 21101 21846 D Pushy   : PushyJobService: Sending keep alive
05-19 23:35:32.917 21101 22010 D Pushy   : PushyJobService: Sending keep alive
05-19 23:35:48.575 14174 22014 D Pushy   : PushyJobService: Sending keep alive
05-19 23:35:49.072 21101 22010 D Pushy   : PushyJobService: Sending keep alive
05-19 23:36:04.435 21101 22010 D Pushy   : PushyJobService: Sending keep alive
05-19 23:36:19.703 21101 22010 D Pushy   : PushyJobService: Sending keep alive
05-19 23:36:35.057 21101 22074 D Pushy   : PushyJobService: Sending keep alive
05-19 23:36:52.568 21101 22080 D Pushy   : PushyJobService: Sending keep alive
05-19 23:37:07.908 21101 22084 D Pushy   : PushyJobService: Sending keep alive
05-19 23:37:23.297 21101 22086 D Pushy   : PushyJobService: Sending keep alive
05-19 23:37:38.667 21101 22088 D Pushy   : PushyJobService: Sending keep alive
05-19 23:37:54.015 21101 22092 D Pushy   : PushyJobService: Sending keep alive
05-19 23:38:09.397 21101 22097 D Pushy   : PushyJobService: Sending keep alive
05-19 23:38:24.742 21101 22100 D Pushy   : PushyJobService: Sending keep alive
05-19 23:38:40.094 21101 22100 D Pushy   : PushyJobService: Sending keep alive
05-19 23:38:55.459 21101 22108 D Pushy   : PushyJobService: Sending keep alive
05-19 23:39:10.825 21101 22113 D Pushy   : PushyJobService: Sending keep alive
05-19 23:39:27.007 21101 22115 D Pushy   : PushyJobService: Sending keep alive
05-19 23:39:42.307 21101 22121 D Pushy   : PushyJobService: Sending keep alive
05-19 23:39:57.725 21101 22129 D Pushy   : PushyJobService: Sending keep alive
05-19 23:40:13.083 21101 22132 D Pushy   : PushyJobService: Sending keep alive
05-19 23:40:30.319 21101 22134 D Pushy   : PushyJobService: Sending keep alive
05-19 23:40:45.645 21101 22139 D Pushy   : PushyJobService: Sending keep alive
05-19 23:40:50.272 14174 22136 D Pushy   : PushyJobService: Sending keep alive
05-19 23:41:05.955 21101 22139 D Pushy   : PushyJobService: Sending keep alive
05-19 23:41:27.449 21101 22139 D Pushy   : PushyJobService: Sending keep alive
05-19 23:41:48.322 21101 22300 D Pushy   : PushyJobService: Sending keep alive
05-19 23:42:04.069 21101 22314 D Pushy   : PushyJobService: Sending keep alive
05-19 23:42:19.371 21101 22325 D Pushy   : PushyJobService: Sending keep alive
05-19 23:42:36.231 21101 22327 D Pushy   : PushyJobService: Sending keep alive
05-19 23:42:51.507 21101 22336 D Pushy   : PushyJobService: Sending keep alive
05-19 23:43:06.865 21101 22343 D Pushy   : PushyJobService: Sending keep alive
05-19 23:43:22.209 21101 22369 D Pushy   : PushyJobService: Sending keep alive
05-19 23:43:37.515 21101 22426 D Pushy   : PushyJobService: Sending keep alive
05-19 23:43:52.823 21101 22433 D Pushy   : PushyJobService: Sending keep alive
05-19 23:44:09.923 21101 22435 D Pushy   : PushyJobService: Sending keep alive
05-19 23:44:28.077 21101 22435 D Pushy   : PushyJobService: Sending keep alive
05-19 23:44:43.515 21101 22445 D Pushy   : PushyJobService: Sending keep alive
05-19 23:44:58.859 21101 22450 D Pushy   : PushyJobService: Sending keep alive
05-19 23:45:14.224 21101 22454 D Pushy   : PushyJobService: Sending keep alive
05-19 23:45:29.536 21101 22458 D Pushy   : PushyJobService: Sending keep alive
05-19 23:45:44.848 21101 22461 D Pushy   : PushyJobService: Sending keep alive
05-19 23:45:58.510 14174 22463 D Pushy   : PushyJobService: Sending keep alive
05-19 23:46:01.139 21101 22464 D Pushy   : PushyJobService: Sending keep alive
05-19 23:46:16.435 21101 22468 D Pushy   : PushyJobService: Sending keep alive
05-19 23:46:32.748 21101 22470 D Pushy   : PushyJobService: Sending keep alive
05-19 23:46:48.049 21101 22470 D Pushy   : PushyJobService: Sending keep alive
05-19 23:47:04.418 21101 22475 D Pushy   : PushyJobService: Sending keep alive
05-19 23:47:19.753 21101 22481 D Pushy   : PushyJobService: Sending keep alive
05-19 23:47:35.033 21101 22484 D Pushy   : PushyJobService: Sending keep alive
05-19 23:47:53.155 21101 22493 D Pushy   : PushyJobService: Sending keep alive
05-19 23:48:10.767 21101 22493 D Pushy   : PushyJobService: Sending keep alive
05-19 23:48:29.248 21101 22520 D Pushy   : PushyJobService: Sending keep alive
05-19 23:48:44.570 21101 22523 D Pushy   : PushyJobService: Sending keep alive
05-19 23:48:59.904 21101 22689 D Pushy   : PushyJobService: Sending keep alive
05-19 23:49:16.535 21101 22702 D Pushy   : PushyJobService: Sending keep alive
05-19 23:49:32.897 21101 22711 D Pushy   : PushyJobService: Sending keep alive
05-19 23:49:48.265 21101 22747 D Pushy   : PushyJobService: Sending keep alive
05-19 23:50:04.548 21101 22775 D Pushy   : PushyJobService: Sending keep alive
05-19 23:50:20.717 21101 22795 D Pushy   : PushyJobService: Sending keep alive
05-19 23:50:38.338 21101 22806 D Pushy   : PushyJobService: Sending keep alive
05-19 23:50:55.846 21101 22810 D Pushy   : PushyJobService: Sending keep alive
05-19 23:50:59.871 14174 22812 D Pushy   : PushyJobService: Sending keep alive
05-19 23:51:11.135 21101 22810 D Pushy   : PushyJobService: Sending keep alive
05-19 23:51:29.326 21101 22810 D Pushy   : PushyJobService: Sending keep alive
05-19 23:51:44.621 21101 22810 D Pushy   : PushyJobService: Sending keep alive
05-19 23:51:59.943 21101 22873 D Pushy   : PushyJobService: Sending keep alive
05-19 23:52:15.286 21101 22873 D Pushy   : PushyJobService: Sending keep alive
05-19 23:52:40.091 21101 22881 D Pushy   : PushyJobService: Sending keep alive
05-19 23:52:55.409 21101 22881 D Pushy   : PushyJobService: Sending keep alive
05-19 23:53:20.068 21101 22893 D Pushy   : PushyJobService: Sending keep alive
05-19 23:53:35.991 21101 22929 D Pushy   : PushyJobService: Sending keep alive
05-19 23:53:51.372 21101 22934 D Pushy   : PushyJobService: Sending keep alive
05-19 23:54:06.686 21101 22936 D Pushy   : PushyJobService: Sending keep alive
05-19 23:54:22.073 21101 22942 D Pushy   : PushyJobService: Sending keep alive
05-19 23:54:38.533 21101 22947 D Pushy   : PushyJobService: Sending keep alive
05-19 23:54:53.974 21101 22981 D Pushy   : PushyJobService: Sending keep alive
05-19 23:55:09.247 21101 23018 D Pushy   : PushyJobService: Sending keep alive
05-19 23:55:24.539 21101 23060 D Pushy   : PushyJobService: Sending keep alive
05-19 23:55:39.907 21101 23063 D Pushy   : PushyJobService: Sending keep alive
05-19 23:55:56.276 21101 23084 D Pushy   : PushyJobService: Sending keep alive
05-19 23:56:07.391 14174 23088 D Pushy   : PushyJobService: Sending keep alive
05-19 23:56:14.209 21101 23084 D Pushy   : PushyJobService: Sending keep alive
05-19 23:56:29.501 21101 23091 D Pushy   : PushyJobService: Sending keep alive
05-19 23:56:44.821 21101 23093 D Pushy   : PushyJobService: Sending keep alive
05-19 23:57:00.210 21101 23102 D Pushy   : PushyJobService: Sending keep alive
05-19 23:57:15.484 21101 23121 D Pushy   : PushyJobService: Sending keep alive
05-19 23:57:31.254 21101 23128 D Pushy   : PushyJobService: Sending keep alive
05-19 23:57:46.534 21101 23140 D Pushy   : PushyJobService: Sending keep alive
05-19 23:58:01.815 21101 23149 D Pushy   : PushyJobService: Sending keep alive
05-19 23:58:17.104 21101 23177 D Pushy   : PushyJobService: Sending keep alive
05-19 23:58:34.891 21101 23200 D Pushy   : PushyJobService: Sending keep alive
05-19 23:58:50.175 21101 23200 D Pushy   : PushyJobService: Sending keep alive
05-19 23:59:05.468 21101 23207 D Pushy   : PushyJobService: Sending keep alive
05-19 23:59:20.781 21101 23211 D Pushy   : PushyJobService: Sending keep alive
05-19 23:59:43.073 21101 23214 D Pushy   : PushyJobService: Sending keep alive
05-19 23:59:58.425 21101 23222 D Pushy   : PushyJobService: Sending keep alive

(I've omitted lines like dropping data for dimension key ... from the above log which were numerous.)

Our heartbeat interval is the default of 5 minutes, and this was indeed the frequency of keep-alive messages logged right after the app was launched.

I could not find the git repository for pushy-sdk-android to debug this but one theory is that each failed reconnect potentially causes a new alarm to be set so we end up with multiple alarms running in parallel, increasing the effective frequency. That theory could be wrong, perhaps there is some significance to the "15 second" interval. I was testing this on a Google Pixel 3a (i.e. not one of the Chinese-manufactured devices listed as requiring more frequent keep-alive intervals.)

On a side note, I have been following Google's guide to gather more information on this however it is also difficult to monitor the alarm usage since Pushy doesn't set a tag on the alarm (See best practices ).

build with pushy_flutter package error in flutter

I trying to install pushy package but when i installed and rebuild project
showing to me this error


Environment

[√] Flutter (Channel beta, 1.21.0-9.2.pre, on Microsoft Windows [Version 10.0.19041.450], locale en-

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.0)
[√] VS Code, 64-bit edition (version 1.43.1)
[√] Connected device (4 available)

• No issues found!

Consol

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':pushy_flutter'.

Could not resolve all artifacts for configuration ':pushy_flutter:classpath'.
Could not find gradle.jar (com.android.tools.build:gradle:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
Could not find builder.jar (com.android.tools.build:builder:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.2.1/builder-3.2.1.jar
Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.2.1/tracker-26.2.1.jar
Could not find shared.jar (com.android.tools.analytics-library:shared:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.2.1/shared-26.2.1.jar
Could not find crash.jar (com.android.tools.analytics-library:crash:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1.jar
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.2.1/lint-gradle-api-26.2.1.jar
Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.2.1/gradle-api-3.2.1.jar
Could not find databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.2.1/databinding-compiler-common-3.2.1.jar
Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.2.1/manifest-merger-26.2.1.jar
Could not find sdk-common.jar (com.android.tools:sdk-common:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.2.1/sdk-common-26.2.1.jar
Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-api-3.2.1.jar
Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.2.1/ddmlib-26.2.1.jar
Could not find sdklib.jar (com.android.tools:sdklib:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.2.1/sdklib-26.2.1.jar
Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.2.1/layoutlib-api-26.2.1.jar
Could not find dvlib.jar (com.android.tools:dvlib:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.2.1/dvlib-26.2.1.jar
Could not find repository.jar (com.android.tools:repository:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.2.1/repository-26.2.1.jar
Could not find common.jar (com.android.tools:common:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/common/26.2.1/common-26.2.1.jar
Could not find jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar
Could not find bundletool.jar (com.android.tools.build:bundletool:0.5.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.5.0/bundletool-0.5.0.jar
Could not find jetifier-core.jar (com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-alpha10/jetifier-core-1.0.0-alpha10.jar
Could not find builder-model.jar (com.android.tools.build:builder-model:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.2.1/builder-model-3.2.1.jar
Could not find protos.jar (com.android.tools.analytics-library:protos:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.2.1/protos-26.2.1.jar
Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.2.1/apkzlib-3.2.1.jar
Could not find apksig.jar (com.android.tools.build:apksig:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.2.1/apksig-3.2.1.jar
Could not find annotations.jar (com.android.tools:annotations:26.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.2.1/annotations-26.2.1.jar
Could not find databinding-common.jar (androidx.databinding:databinding-common:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.2.1/databinding-common-3.2.1.jar
Could not find baseLibrary.jar (com.android.databinding:baseLibrary:3.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.2.1/baseLibrary-3.2.1.jar
Could not get unknown property 'android' for project ':pushy_flutter' of type org.gradle.api.Project.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin flutter_local_notifications...
Running Gradle task 'assembleAarRelease'...

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':compileReleaseAidl'.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\src\flutter.pub-cache\hosted\pub.dartlang.org\flutter_local_notifications-1.4.4+4\android\local.properties'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s

Exception: The plugin flutter_local_notifications could not be built due to the issue above.

iOS device - "Pushy: Error retrieving handle for Flutter callbacks"

iOS device unable to listen for notifications when setNotificationListener is used.

I am not using firebase-messaging or any other push notification service, what's odd is my code was working yesterday but isn't working today with a similar setup.

I have set up my main file according to the documentation but its not working. So I set a notification listener in my home page that responds with error "Pushy: Error retrieving handle for Flutter callbacks".

SETUP in MAIN FILE
`
void backgroundNotificationListener(Map<String, dynamic> data) {
// Print notification payload data
print('Received notification: $data');

// Notification title
String notificationTitle = 'MyApp';

// Attempt to extract the "message" property from the payload: {"message":"Hello World!"}
String notificationText = data['message'] ?? 'Hello World!';

// Android: Displays a system notification
// iOS: Displays an alert dialog
Pushy.notify(notificationTitle, notificationText, data);

// Clear iOS app badge number
Pushy.clearBadge();
}

void main() async {

WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
Pushy.toggleInAppBanner(true);

//this listener doesn't respond at all, no errors and no notifications.
Pushy.setNotificationListener(backgroundNotificationListener);

//initLogic takes me to home page
runApp(initLogic());

}`

SETUP in HOME PAGE

` @OverRide
void initState() {
print("listening");
Pushy.listen();

//here the setNotificationListener prints "Pushy: Error retrieving handle for Flutter callbacks"
Pushy.setNotificationListener((data) {
print('Received notification: $data');

  // Notification title
  String notificationTitle = 'MyApp';

  // Attempt to extract the "message" property from the payload: {"message":"Hello World!"}
  String notificationText = data['message'] ?? 'Hello World!';

  // Android: Displays a system notification
  // iOS: Displays an alert dialog
  Pushy.notify(notificationTitle, notificationText, data);

  // Clear iOS app badge number
  Pushy.clearBadge();
});

//...other stuff in initState

}`

Device not waking up when receiving a notification

pushy_flutter: ^1.0.12

When the device is locked and we send a notification - the device screen does not come on nor does it show a notification bar?

Do you have any ideas how we can awake the device and show a notification that can be clicked?

Thanks

Cannot get my Device token

the app is just running fine on android but in ios Pushy.register() method is not invoked.

i follow all the steps to config my app but it's still not working in ios.

[Android] Example project not receiving Push Notification when app is terminated

Hello Pushy Team,

I have encountered problem when running the example application. I am not able to receive any push notifications when the app is terminated. However, I am able to receive push notification normally when the app is in foreground and background. I have also changed the default package name from me.pushy.example to my own test package name com.example.pushytest.

I have tested it on Google Pixel and Redmi phone, both yield the same result just the PID is different. Below is the logs I received when the app is terminated and a push notification is send.

Flutter logs

flutter logs

E/AndroidRuntime(13614): FATAL EXCEPTION: main
E/AndroidRuntime(13614): Process: com.example.pushytest, PID: 13614
E/AndroidRuntime(13614): java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference
E/AndroidRuntime(13614):        at io.flutter.embedding.engine.loader.FlutterLoader.findAppBundlePath(FlutterLoader.java:324)
E/AndroidRuntime(13614):        at io.flutter.view.FlutterMain.findAppBundlePath(FlutterMain.java:103)
E/AndroidRuntime(13614):        at me.pushy.sdk.flutter.util.PushyFlutterBackgroundExecutor.startBackgroundIsolate(PushyFlutterBackgroundExecutor.java:76)
E/AndroidRuntime(13614):        at me.pushy.sdk.flutter.util.PushyFlutterBackgroundExecutor.startBackgroundIsolate(PushyFlutterBackgroundExecutor.java:55)
E/AndroidRuntime(13614):        at me.pushy.sdk.flutter.PushyPlugin$3.run(PushyPlugin.java:314)
E/AndroidRuntime(13614):        at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime(13614):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(13614):        at android.os.Looper.loop(Looper.java:201)
E/AndroidRuntime(13614):        at android.app.ActivityThread.main(ActivityThread.java:6810)
E/AndroidRuntime(13614):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13614):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
E/AndroidRuntime(13614):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

Additional

flutter doctor

[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 12.0)
    ! CocoaPods 1.7.0 out of date (1.8.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that
        responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade:
        sudo gem install cocoapods
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2020.1.2)
[✓] VS Code (version 1.51.1)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

Building with proguard Android

Hi thjere,

I'm trying to build the app for release but getting the following error, any ideas?

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/zzz/.pub-cache/hosted/pub.dartlang.org/pushy_flutter-1.1.1/android/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'pushy_flutter'.
> Failed to apply plugin [id 'com.android.internal.version-check']
   > Minimum supported Gradle version is 6.1.1. Current version is 5.6.2. If using the gradle wrapper, try editing the distributionUrl in /Users/zzz/.pub-cache/hosted/pub.dartlang.org/pushy_flutter-1.1.1/android/gradle/wrapper/gradle-wrapper.properties to gradle-6.1.1-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 480ms


The plugin pushy_flutter could not be built due to the issue above.

Running on Release I got "No serializer found for class..."

image

I/flutter ( 6534): Error: No serializer found for class c.a.a.e.c.a and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
Application finished.

Tried with my local app and the example app from here.

(in debug mode works normally)

Device - Pixel 5

Notification received Android but not Flutter

We recently started getting this and nothing has changed on our app.

Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.5 19F101, locale en-ZA)

D/Pushy   ( 1489): Received push for package dev.terminal.salt
D/Pushy   ( 1489): {transactionId=4382}
D/Pushy   ( 1489): Invoking cached push receiver via reflection: com.example.yoyo_terminal.PushReceiver
D/Pushy   ( 1489): Invoking cached push receiver via reflection: me.pushy.sdk.flutter.internal.PushyInternalReceiver
E/Pushy   ( 1489): Isolate / notification callback IDs are missing from SharedPreferences

Any ideas?

setNotificationClickListener not working in IOS

I need to listen to the Push notification when a user clicking on it. So I used setNotificationClickListener to listen on user click, but unfortunately, I am not getting any response on it.

`Pushy.setNotificationListener` has no effect on iOS

It seems the Pushy.setNotificationListener method has no effect on iOS. The listener I passed into it is not called when the app runs on iOS. I need to display the notification based on fields in the data payload as well as user data in the app, however without being able to pass in a notification listener I am not able to do either. Based on your documentation and examples, this method is said to be available for both platforms. Could you please fix it? Thanks!

notification icon grey out

I have set Pushy.setNotificationIcon('ic_notification'); after Pushy.listen(); and put all ic_notification.png to all mipmap folder , but the notification is still grey out.

Notifications not showing when app is in background or foreground

Hi we have a flutter app that works fine on a number of android devices but this particular model doesn't want to show notifications on the home screen or when the app is in foreground mode.

Tablet Model

Lenovo Tab E8
Android 7 Nougat

and in our app

pushy_flutter:
dependency: "direct main"
description:
name: pushy_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"

NotificationListener doesn't work when work with Firebase Auth together

Hello Team,

I noticed backgroundNotificationListener & setNotificationClickListener are not working when we integrated Pushy with Firebase Auth (Phone).

Our App would like to use Pushy for notification and Firebase Auth(Phone) as the login solution, my environment is Flutter 1.22.4, below is the plugin version:

pushy_flutter: ^1.1.6
firebase_core: 0.5.2
firebase_messaging: ^8.0.0-dev.8
firebase_auth: 0.18.3

I disable the swizzling in the Info.plist
FirebaseAppDelegateProxyEnabled

I also implemented the below logic in AppDelegate.swift

import UIKit
import Flutter
import Firebase
import FirebaseAuth
import UserNotifications
import FirebaseInstanceID

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
 override func application(
   _ application: UIApplication,
   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
 ) -> Bool {
       print("init")
       FirebaseApp.configure()
       GeneratedPluginRegistrant.register(with: self)
    if #available(iOS 10.0, *) {
               print("mark11")
             UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
   }
   application.registerForRemoteNotifications()
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
 }

   override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
       let firebaseAuth = Auth.auth()
       firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.unknown)
       return super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
   }

   override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

       let firebaseAuth = Auth.auth()
    if (firebaseAuth.canHandleNotification(userInfo)) {
        completionHandler(.noData)
        return
    }
      return super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
   
   }
}

Flutter code:

import 'package:flutter/services.dart';
import 'dart:io' show Platform;

import 'package:flutter/services.dart';
import 'package:pushy_flutter/pushy_flutter.dart';

import '../../util/_base_export.dart';
import 'app_main.dart';
import '../others/page_upgrade.dart';
import '../others/page_select_wh.dart';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';

class AppFrameView extends StatefulWidget {
  @override
  _AppFrameViewState createState() => _AppFrameViewState();
}

class _AppFrameViewState extends State<AppFrameView> {
  String _deviceToken = 'Loading...';

  @override
  void initState() {
    super.initState();
    // print('Pushy starting');
    initPlatformState();
  }

  void backgroundNotificationListener(Map<String, dynamic> data) {
    // Print notification payload data
    print('Received notification: $data');
    // Notification title
    String notificationTitle = 'MyApp';
    // Attempt to extract the "message" property from the payload: {"message":"Hello World!"}
    String notificationText = data['message'] ?? 'Hello World!';
    // Android: Displays a system notification
    // iOS: Displays an alert dialog
    Pushy.notify(notificationTitle, notificationText, data);
    // Clear iOS app badge number
    Pushy.clearBadge();
  }

  Future<void> initPlatformState() async {
    Pushy.listen();
    // Start the Pushy service
    print('Pushy listened');
    // Set custom notification icon (Android)
    Pushy.setNotificationIcon('ic_notify');
    try {
      // Register the device for push notifications
      String deviceToken = await Pushy.register();

      // Print token to console/logcat
      print('Device token: $deviceToken');

    } on PlatformException catch (error) {
      // Print to console/logcat
      print('Error: ${error.message}');

    }

    // Listen for push notifications received
    Pushy.setNotificationListener(backgroundNotificationListener);

    // Listen for push notification clicked
    Pushy.setNotificationClickListener((Map<String, dynamic> data) {
      // Print notification payload data
      print('Notification clicked: $data');
      Pushy.clearBadge();
    });
  }

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(
      context,
      designSize: Size(AppScreen.initWidth, AppScreen.initHeight),
      allowFontScaling: false,
    );
    return MaxScaleTextWidget(
      max: 1.0,
      child: Builder(
        builder: (context) {
          if (((AppSession.packageInfo?.version ?? '') != AppSession.appUtil.last_version) &&
              (AppSession.appUtil.force_update == true))
            return OtherUpgradePage();
          else if (AppSession.wh_id == 0)
            return SelectWhPage();
          else
            return AppMainView();
        },
      ),
    );
  }
}

The symptom is,

  1. I can fetch the device token,
  2. Firebase Auth is working
  3. Notification can be received.
  4. However the backgroundNotificationListener & setNotificationClickListener doesn't work, no matter inside App or outside App, and the badge won't be removed even if I navigated back to App

Then, I tried to modify the logic about the AppDelegate with below:

override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

       let firebaseAuth = Auth.auth()
    // if (firebaseAuth.canHandleNotification(userInfo)) {
    //    completionHandler(.noData)
    //    return
    // }
      return super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
   
   }

After the rebuild, Pushy is totally working well, however, the Firebase Auth didn't work and shown below message:
"com.google.firebase.auth" : {
"warning" : "This fake notification should be forwarded to Firebase Auth."
}

I also tried to remove the "FirebaseAppDelegateProxyEnabled" setting in the Info.plist, but the Pushy can't fetch the device token.

That's issue I faced. Could you take a look and advise? Thanks so much.

Anthony

Unable to run on iOS

Getting the following error.

/Users/xxx/.pub-cache/hosted/pub.dartlang.org/pushy_flutter-1.0.11/ios/Classes/PushyPlugin.m:2:9: 'pushy_flutter/pushy_flutter-Swift.h' file not found
[✓] Flutter (Channel master, 1.19.0-4.0.pre.20, on Mac OS X 10.15.1 19B88, locale en-ZA)
    • Flutter version 1.19.0-4.0.pre.20 at /Users/calvinmuller/iStreet/Mobile/flutter
    • Framework revision 2ece1c3a17 (33 hours ago), 2020-06-02 19:00:12 -0700
    • Engine revision 6589dcb2d4
    • Dart version 2.9.0 (build 2.9.0-13.0.dev 3d53df52af)

No notification if the app is terminated or killed.

Hi, I'm also encountering the issue on the notification not being shown if the app is closed. does the flutter sdk already handle the sending of notifications even if the app is closed? I checked the source code and it seems it is using the flutter isolate library. It seems flutter isolate is also killed if the app is already killed

[Android] conflict with `flutter_secure_storage` that require the app to be migrated to Android embedding v2

Hi !

I want to upgrade my app from flutter v2.8.1 to v2.10.2
But with flutter version 2.10.2, i've a conflict between pushy_flutter and flutter_secure_storage when i tried to build on android

I get this error :

The plugin `flutter_secure_storage` requires your app to be migrated to the Android embedding v2. Follow the steps on
https://flutter.dev/go/android-project-migration and re-run this command.

Here is my AndroidManifest :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="MyAppPackage">
   <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="MyAppLabel"
        android:icon="@mipmap/ic_launcher">
        <!-- Pushy Declarations -->

        <!-- Internal Notification Receiver -->
        <!-- Do not modify - internal BroadcastReceiver that sends notifications to your Flutter app -->
        <receiver android:name="me.pushy.sdk.flutter.internal.PushyInternalReceiver" android:exported="false">
            <intent-filter>
                <!-- Do not modify this -->
                <action android:name="pushy.me" />
            </intent-filter>
        </receiver>

        <!-- Pushy Update Receiver -->
        <!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
        <receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver" android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>

        <!-- Pushy Boot Receiver -->
        <!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
        <receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver" android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>

        <!-- Pushy Socket Service -->
        <!-- Do not modify - internal service -->
        <service android:name="me.pushy.sdk.services.PushySocketService" android:stopWithTask="false" />

        <!-- Pushy Job Service (added in Pushy SDK 1.0.35) -->
        <!-- Do not modify - internal service -->
        <service android:name="me.pushy.sdk.services.PushyJobService"
            android:permission="android.permission.BIND_JOB_SERVICE"
            android:stopWithTask="false" />

        <!-- End Pushy Declarations -->
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <!-- Deep linking -->
            <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="MyScheme" android:host="MyHost" />
                <data android:scheme="https" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
</manifest>

My problem seems to be linked to this line in my AndroidManifest :
android:name="io.flutter.app.FlutterApplication"
And to this issue on this repo : #33

Here is my pubspec :

name: flutter_app
description: A new Flutter project.
version: 1.0.0

environment:
  sdk: ">=2.15.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_secure_storage: ^5.0.2
  pushy_flutter: ^2.0.3

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^1.0.4

flutter:

Here is my flutter doctor :

──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  ...MyApp/android/app/src/main/AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-x64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.64.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!```

Installing background listener fails in release mode

Running the example in --release mode leads to the following errors:

E/flutter (28320): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:pushy_flutter/pushy_flutter.dart' not found.
E/flutter (28320): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter (28320): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
E/flutter (28320): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
E/flutter (28320): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.

Any help is appreciated!

(.. changed the deprecated FlatButton to an ElevatedButton in the example code)

My setup is:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.1, on Debian GNU/Linux 11 (bullseye) 5.10.0-18-amd64, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

notification received in console, but notification not appear on device

pushy_flutter: ^2.0.1

Here's my implementation

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SentryFlutter.init(
    (options) => options.dsn = 'https://[email protected]/0',
    appRunner: () => runApp(
      Phoenix(
        child: AppCore(),
      ),
    ),
  );
}

class _AppCoreState extends State<AppCore> {
  @override
  void initState() {
    super.initState();
    Pushy.listen();
    initClearNotificationsState();

    Pushy.setNotificationClickListener((Map<String, dynamic> data) {
      print('Notification click: $data');

      Pushy.clearBadge();
    });
    // Listen for push notifications received
    Pushy.setNotificationListener(backgroundNotificationListener);
  }
}

here's the log I am receiving when I send push to this device.
Screen Shot 2021-11-26 at 2 04 28 PM

But notification is not appearing

I tried another demo, its working fine. but not in my real app. is this because I am wrapping this implementation in sentry?

Only tested this android.

Also Its say Invoking notification listener in foreground (no isolate), though my app is in background state.

[iOS] Error 'pod install' with last 'pushy_flutter 1.0.3' and 'Flutter 1.12.13'

Hi! We got a problem with iOS build after updated on 'pushy_flutter 1.0.3' and 'Flutter 1.12.13'

Steps to Reproduce

  1. Clean flutter
flutter clean 
  1. Get flutter dependencies
flutter pub cache repair
flutter pub upgrade
flutter pub get
  1. Try pod install
pod install

Logs

pod install
Analyzing dependencies
...
Fetching podspec for `pushy_flutter` from `.symlinks/plugins/pushy_flutter/ios`
...
Downloading dependencies
...
Installing Pushy (1.0.20)
Installing pushy_flutter (1.0.3)
...
Generating Pods project
Integrating client project
Pod installation complete! There are 14 dependencies from the Podfile and 28 total pods installed.
[!] Automatically assigning platform `ios` with version `10.2` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] A license was specified in podspec `pushy_flutter` but the file does not exist - /.../mobile/ios/.symlinks/plugins/pushy_flutter/ios/LICENSE

[!] Unable to read the license file `LICENSE` for the spec `pushy_flutter (1.0.3)`

[!] Unable to read the license file `LICENSE` for the spec `pushy_flutter (1.0.3)`

As I see, in your documentation, you recommend to use Pushy SDK '1.0.21', but in pushy flutter 1.0.3 you still use Pushy SDK '1.0.20'. May be problem in that.

Additional

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88,
    locale en-RU)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)
[✓] Connected device (2 available)

Thanks for any helps!

Unable to turn off notifications with Pushy.toggleNotifications(false) and Pushy.toggleFCM(false)

I need to stop the notifications in the app when a user logout. I have these calls in my logout method:

Pushy.toggleFCM(false);
Pushy.toggleNotifications(false);

And according to the logs these methods indeed get called:

2021-01-27 13:16:12.208 29530-29530/[package.name] D/Pushy: Stop requested
2021-01-27 13:16:12.525 29530-2935/[package.name] D/Pushy: Connection lost
2021-01-27 13:16:12.525 29530-2935/[package.name] D/Pushy: Notifications have been disabled by the app

However after this, when I send a further notification from the Pushy dashboard, I still received it on the phone, which means the notification was not turned off. Please advice how I can toggle the notification off. Thanks!

Pushy.register() hangs when called

Similar to this issue: #20

Pushy.register() doesn't return a device token when called, instead it hangs and no line after it is executed. I followed the steps in the documentation. Currently on Pushy version 2.0.4. I use Firebase in my app, however currently migrating from FCM to Pushy and I've removed all FCM plugins.


try {
     // Register the user for push notifications
     String deviceToken = await Pushy.register();

     // Print token to console/logcat
     print('Device token: $deviceToken');

await Pushy.register hangs

I am using the latest version pushy_flutter: 1.1.7

I am following the docs. Pushy.listen() and Pushy.setNotificationListener(backgroundNotificationListener); seem to work okay, however Pushy.register() hangs.

try {
      print("pushyRegister try{}");
      String deviceToken = await Pushy.register();
      print("pushyRegister deviceToken " + deviceToken);
    } catch (error) {
      print("pushyRegister catch " + error);
    }

In my logcat, I only see "pushyRegister try{}".
catch isn't being called. Any ideas of why this could happen.

I am also using Firebase in my project

Notifications not showing when app is killed (Android)

Device pixel 3a

  • It works fine in foreground and background (resumed)
    Logcat when app is killed:

2021-07-23 16:24:41.737 30589-30589/com.example.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 30589
java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference
at io.flutter.embedding.engine.loader.FlutterLoader.findAppBundlePath(FlutterLoader.java:364)
at io.flutter.view.FlutterMain.findAppBundlePath(FlutterMain.java:104)
at me.pushy.sdk.flutter.util.PushyFlutterBackgroundExecutor.startBackgroundIsolate(PushyFlutterBackgroundExecutor.java:76)
at me.pushy.sdk.flutter.util.PushyFlutterBackgroundExecutor.startBackgroundIsolate(PushyFlutterBackgroundExecutor.java:55)
at me.pushy.sdk.flutter.PushyPlugin$3.run(PushyPlugin.java:314)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

High Battery Usage (some Samsung Devices)

Hi.
Are there known problems with some Samsung devices (e.g. Samsung S10e, A40, Note9, S9)?
We found that the battery consumption is quite high.
Android 11
SDK: 30
pushy_flutter: ^2.0.5

Logcat of our App:
2022-05-17 13:13:54.891 4284-4414/? D/ActivityManager: Received BROADCAST intent 0x3fa0758 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:13:54.995 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131410 now=51252158 - CU:10259/CP:29505/OP:PendingIntent{5fab56e: PendingIntentRecord{1af40f com.*.* broadcastIntent}} 2022-05-17 13:14:10.032 4284-6260/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131426 now=51267195 - CU:10259/CP:29505/OP:PendingIntent{78c11b8: PendingIntentRecord{59cb91 com.*.* broadcastIntent}} 2022-05-17 13:14:25.094 4284-6260/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131441 now=51282257 - CU:10259/CP:29505/OP:PendingIntent{3a6fdda: PendingIntentRecord{eb20b com.*.* broadcastIntent}} 2022-05-17 13:14:40.160 4284-6260/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131456 now=51297323 - CU:10259/CP:29505/OP:PendingIntent{843f8ad: PendingIntentRecord{d83c7e2 com.*.* broadcastIntent}} 2022-05-17 13:14:56.153 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{16ac7cf type 0 when 1652786096152 com.*.*} 2022-05-17 13:14:56.154 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xd83c7e2 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:14:56.234 4284-6224/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131512 now=51313397 - CU:10259/CP:29505/OP:PendingIntent{252713a: PendingIntentRecord{87611eb com.*.* broadcastIntent}} 2022-05-17 13:15:11.282 4284-6818/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131527 now=51328445 - CU:10259/CP:29505/OP:PendingIntent{12bf05f: PendingIntentRecord{b6c7aac com.*.* broadcastIntent}} 2022-05-17 13:15:26.358 4284-4301/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131542 now=51343521 - CU:10259/CP:29505/OP:PendingIntent{861821a: PendingIntentRecord{144814b com.*.* broadcastIntent}} 2022-05-17 13:15:41.406 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131557 now=51358569 - CU:10259/CP:29505/OP:PendingIntent{833eeb3: PendingIntentRecord{2495c70 com.*.* broadcastIntent}} 2022-05-17 13:15:57.401 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{644812b type 0 when 1652786157401 com.*.*} 2022-05-17 13:15:57.403 4284-4414/? D/ActivityManager: Received BROADCAST intent 0x2495c70 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:15:57.498 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131613 now=51374661 - CU:10259/CP:29505/OP:PendingIntent{64e0f46: PendingIntentRecord{e080507 com.*.* broadcastIntent}} 2022-05-17 13:16:12.558 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131628 now=51389721 - CU:10259/CP:29505/OP:PendingIntent{d16adce: PendingIntentRecord{6f0f4ef com.*.* broadcastIntent}} 2022-05-17 13:16:27.613 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131643 now=51404776 - CU:10259/CP:29505/OP:PendingIntent{f557683: PendingIntentRecord{dd19000 com.*.* broadcastIntent}} 2022-05-17 13:16:42.658 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131658 now=51419821 - CU:10259/CP:29505/OP:PendingIntent{268f930: PendingIntentRecord{dbee9a9 com.*.* broadcastIntent}} 2022-05-17 13:16:58.650 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{a7354bc type 0 when 1652786218649 com.*.*} 2022-05-17 13:16:58.651 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xdbee9a9 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:16:58.765 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131714 now=51435928 - CU:10259/CP:29505/OP:PendingIntent{c9520cb: PendingIntentRecord{37f00a8 com.*.* broadcastIntent}} 2022-05-17 13:17:13.831 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131729 now=51450994 - CU:10259/CP:29505/OP:PendingIntent{96a1d7c: PendingIntentRecord{1128605 com.*.* broadcastIntent}} 2022-05-17 13:17:28.870 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131744 now=51466033 - CU:10259/CP:29505/OP:PendingIntent{2585bb9: PendingIntentRecord{5a79bfe com.*.* broadcastIntent}} 2022-05-17 13:17:43.918 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131759 now=51481081 - CU:10259/CP:29505/OP:PendingIntent{d3a09dc: PendingIntentRecord{cdf6ae5 com.*.* broadcastIntent}} 2022-05-17 13:17:59.910 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{5fc7786 type 0 when 1652786279909 com.*.*} 2022-05-17 13:17:59.912 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xcdf6ae5 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:18:00.020 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131816 now=51497183 - CU:10259/CP:29505/OP:PendingIntent{c988612: PendingIntentRecord{9b6c1e3 com.*.* broadcastIntent}} 2022-05-17 13:18:15.070 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131831 now=51512233 - CU:10259/CP:29505/OP:PendingIntent{1403fc5: PendingIntentRecord{3275d1a com.*.* broadcastIntent}} 2022-05-17 13:18:30.116 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131846 now=51527279 - CU:10259/CP:29505/OP:PendingIntent{dd9d717: PendingIntentRecord{813c704 com.*.* broadcastIntent}} 2022-05-17 13:18:45.364 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131901 now=51542527 - CU:10259/CP:29505/OP:PendingIntent{381a46: PendingIntentRecord{808b407 com.*.* broadcastIntent}} 2022-05-17 13:19:00.402 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131916 now=51557565 - CU:10259/CP:29505/OP:PendingIntent{6ed9583: PendingIntentRecord{d08c300 com.*.* broadcastIntent}} 2022-05-17 13:19:15.494 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131931 now=51572657 - CU:10259/CP:29505/OP:PendingIntent{533bde2: PendingIntentRecord{9aee573 com.*.* broadcastIntent}} 2022-05-17 13:19:31.485 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{981938c type 0 when 1652786371485 com.*.*} 2022-05-17 13:19:31.486 4284-4414/? D/ActivityManager: Received BROADCAST intent 0x9aee573 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:19:31.578 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T131947 now=51588741 - CU:10259/CP:29505/OP:PendingIntent{35849db: PendingIntentRecord{d7a5c78 com.*.* broadcastIntent}} 2022-05-17 13:19:46.678 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132002 now=51603841 - CU:10259/CP:29505/OP:PendingIntent{5f70e4a: PendingIntentRecord{7c7d1bb com.*.* broadcastIntent}} 2022-05-17 13:20:01.750 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132017 now=51618913 - CU:10259/CP:29505/OP:PendingIntent{7738b87: PendingIntentRecord{21fbab4 com.*.* broadcastIntent}} 2022-05-17 13:20:16.798 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132032 now=51633961 - CU:10259/CP:29505/OP:PendingIntent{9078676: PendingIntentRecord{8706477 com.*.* broadcastIntent}} 2022-05-17 13:20:31.856 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132047 now=51649019 - CU:10259/CP:29505/OP:PendingIntent{6e701b2: PendingIntentRecord{48c2503 com.*.* broadcastIntent}} 2022-05-17 13:20:47.850 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{6972175 type 0 when 1652786447849 com.*.*} 2022-05-17 13:20:47.852 4284-4414/? D/ActivityManager: Received BROADCAST intent 0x48c2503 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:20:47.978 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132103 now=51665141 - CU:10259/CP:29505/OP:PendingIntent{7096a57: PendingIntentRecord{3b2f944 com.*.* broadcastIntent}} 2022-05-17 13:20:48.046 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132104 now=51665209 - CU:10259/CP:29505/OP:PendingIntent{73f3b62: PendingIntentRecord{9d054f3 com.*.* broadcastIntent}} 2022-05-17 13:21:03.107 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132119 now=51680270 - CU:10259/CP:29505/OP:PendingIntent{1de5c5e: PendingIntentRecord{a86283f com.*.* broadcastIntent}} 2022-05-17 13:21:18.160 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132134 now=51695323 - CU:10259/CP:29505/OP:PendingIntent{d4812c2: PendingIntentRecord{17348d3 com.*.* broadcastIntent}} 2022-05-17 13:21:33.223 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132149 now=51710386 - CU:10259/CP:29505/OP:PendingIntent{deb0940: PendingIntentRecord{164a079 com.*.* broadcastIntent}} 2022-05-17 13:21:48.282 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132204 now=51725445 - CU:10259/CP:29505/OP:PendingIntent{d258a04: PendingIntentRecord{c212bed com.*.* broadcastIntent}} 2022-05-17 13:22:03.357 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132219 now=51740520 - CU:10259/CP:29505/OP:PendingIntent{a9f92ef: PendingIntentRecord{89091fc com.*.* broadcastIntent}} 2022-05-17 13:22:18.421 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132234 now=51755584 - CU:10259/CP:29505/OP:PendingIntent{b61b483: PendingIntentRecord{debf600 com.*.* broadcastIntent}} 2022-05-17 13:22:33.489 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132249 now=51770652 - CU:10259/CP:29505/OP:PendingIntent{c87bc1d: PendingIntentRecord{c8a1e92 com.*.* broadcastIntent}} 2022-05-17 13:22:48.550 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132304 now=51785713 - CU:10259/CP:29505/OP:PendingIntent{4b43651: PendingIntentRecord{cedfeb6 com.*.* broadcastIntent}} 2022-05-17 13:23:03.608 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132319 now=51800771 - CU:10259/CP:29505/OP:PendingIntent{9a11c43: PendingIntentRecord{f07a2c0 com.*.* broadcastIntent}} 2022-05-17 13:23:18.671 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132334 now=51815834 - CU:10259/CP:29505/OP:PendingIntent{2b19c33: PendingIntentRecord{5a93bf0 com.*.* broadcastIntent}} 2022-05-17 13:23:33.735 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132349 now=51830898 - CU:10259/CP:29505/OP:PendingIntent{999f823: PendingIntentRecord{e3b8120 com.*.* broadcastIntent}} 2022-05-17 13:23:48.930 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132404 now=51846093 - CU:10259/CP:29505/OP:PendingIntent{afa684d: PendingIntentRecord{f40f02 com.*.* broadcastIntent}} 2022-05-17 13:24:03.962 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132419 now=51861125 - CU:10259/CP:29505/OP:PendingIntent{6e5c9b9: PendingIntentRecord{16371fe com.*.* broadcastIntent}} 2022-05-17 13:24:19.004 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132434 now=51876167 - CU:10259/CP:29505/OP:PendingIntent{18346e6: PendingIntentRecord{637427 com.*.* broadcastIntent}} 2022-05-17 13:24:34.058 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132450 now=51891221 - CU:10259/CP:29505/OP:PendingIntent{d9732ed: PendingIntentRecord{b331522 com.*.* broadcastIntent}} 2022-05-17 13:24:50.051 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{63be2b type 0 when 1652786690050 com.*.*} 2022-05-17 13:24:50.053 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xb331522 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:24:50.141 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132506 now=51907304 - CU:10259/CP:29505/OP:PendingIntent{8303046: PendingIntentRecord{75e1207 com.*.* broadcastIntent}} 2022-05-17 13:25:05.239 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132521 now=51922402 - CU:10259/CP:29505/OP:PendingIntent{e3d1fe7: PendingIntentRecord{3692794 com.*.* broadcastIntent}} 2022-05-17 13:25:20.283 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132536 now=51937446 - CU:10259/CP:29505/OP:PendingIntent{c602ffb: PendingIntentRecord{ab51818 com.*.* broadcastIntent}} 2022-05-17 13:25:35.343 4284-6105/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132551 now=51952506 - CU:10259/CP:29505/OP:PendingIntent{7a2e15c: PendingIntentRecord{a2c2c65 com.*.* broadcastIntent}} 2022-05-17 13:25:51.336 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{bd7fff4 type 0 when 1652786751335 com.*.*} 2022-05-17 13:25:51.337 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xa2c2c65 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:25:51.432 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132607 now=51968595 - CU:10259/CP:29505/OP:PendingIntent{d74f63: PendingIntentRecord{f6f2760 com.*.* broadcastIntent}} 2022-05-17 13:25:57.319 4284-4329/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'pushy:MqttConnectionWakeLock' ACQ=-5s962ms (uid=10259 pid=29505 pkg=com.*.*) 2022-05-17 13:26:07.436 4284-4414/? V/SamsungAlarmManager: Sending to uid : 10259 action=null alarm=Alarm{9799886 type 0 when 1652786767430 com.*.*} 2022-05-17 13:26:07.439 4284-4414/? D/ActivityManager: Received BROADCAST intent 0xf6f2760 Key{broadcastIntent pkg=com.*.* intent=cmp=com.*.*/me.pushy.sdk.receivers.PushyUpdateReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-05-17 13:26:07.569 4284-4695/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132623 now=51984732 - CU:10259/CP:29505/OP:PendingIntent{f6d669d: PendingIntentRecord{146b712 com.*.* broadcastIntent}} 2022-05-17 13:26:12.322 4284-4329/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'pushy:MqttConnectionWakeLock' ACQ=-4s859ms (uid=10259 pid=29505 pkg=com.*.*) 2022-05-17 13:26:22.639 4284-6224/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132638 now=51999802 - CU:10259/CP:29505/OP:PendingIntent{340ee1a: PendingIntentRecord{d4d7d4b com.*.* broadcastIntent}} 2022-05-17 13:26:37.691 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132653 now=52014854 - CU:10259/CP:29505/OP:PendingIntent{5285615: PendingIntentRecord{5a53d2a com.*.* broadcastIntent}} 2022-05-17 13:26:52.737 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132708 now=52029900 - CU:10259/CP:29505/OP:PendingIntent{c8bee85: PendingIntentRecord{a1f44da com.*.* broadcastIntent}} 2022-05-17 13:27:07.811 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132723 now=52044973 - CU:10259/CP:29505/OP:PendingIntent{ec3ab18: PendingIntentRecord{4015971 com.*.* broadcastIntent}} 2022-05-17 13:27:22.864 4284-4817/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132738 now=52060027 - CU:10259/CP:29505/OP:PendingIntent{2fd045c: PendingIntentRecord{8371365 com.*.* broadcastIntent}} 2022-05-17 13:27:37.916 4284-6105/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132753 now=52075079 - CU:10259/CP:29505/OP:PendingIntent{205e4af: PendingIntentRecord{689e0bc com.*.* broadcastIntent}} 2022-05-17 13:27:52.971 4284-6105/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132808 now=52090134 - CU:10259/CP:29505/OP:PendingIntent{e8b5a43: PendingIntentRecord{9a808c0 com.*.* broadcastIntent}} 2022-05-17 13:28:08.050 4284-4810/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132824 now=52105213 - CU:10259/CP:29505/OP:PendingIntent{da75a33: PendingIntentRecord{42f21f0 com.*.* broadcastIntent}} 2022-05-17 13:28:23.101 4284-6105/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132839 now=52120264 - CU:10259/CP:29505/OP:PendingIntent{e5f469b: PendingIntentRecord{cf67a38 com.*.* broadcastIntent}} 2022-05-17 13:28:38.159 4284-6980/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132854 now=52135322 - CU:10259/CP:29505/OP:PendingIntent{7586f: PendingIntentRecord{4eca97c com.*.* broadcastIntent}} 2022-05-17 13:28:53.358 4284-6318/? D/SamsungAlarmManager: setExact (T:0/F:5/AC:false) 20220517T132909 now=52150521 - CU:10259/CP:29505/OP:PendingIntent{cdbf1f3: PendingIntentRecord{2503eb0 com.*.* broadcastIntent}}

backgroundNotificationListener not called when app built with --split-debug-info is killed.

Pushy Flutter's notify method displays primitive notification. It is rigid and not customisable. Currently, if the app is dismissed from or killed calling a third party notification library does not work. (i'm using flutter_local_notifications specifically). i.e the below code should work even when app is killed or in background:

Future<void> backgroundNotificationListener(Map<String, dynamic> data) async {
  print('Received notification: $data');
  
  //initialise and call third party library here to display notification even when app is in background or killed,
  //instead of calling Pushy.notify
}

the above block only works if app is in foreground. One way to solve this would be to expand Pushy's notify method to be more customisable, but given the rich feature set of third party notification libraries, it may be better to find a way to make them work together.

iOS Push permission deined

image

I have already setup all required steps for pushy to work in iOS and it also working on debug and Testflight mode but when i submit app to review then its getting rejected as shown in above image.

Can't save to local storage of notification received on ios when app is closed

backgroundNotificationListener method always calls every time new notification received, Also I call my save notification function inside it. When app is foreground and in the background it works fine, the notification saved to the local storage but if app is closed it is not working. This works fine on android.

A blank screen appears when app is killed and user taps on a notification

When user taps on a push notification in killed state of the app then it will open a white blank screen and app stucks on this screen. When app is in background, it will navigate the user to the desire screen.

main.dart:

//Top-level pushy background notification listener
@pragma('vm:entry-point')
void backgroundNotificationListener(Map<String, dynamic> data) {
  final result = NotificationData.fromJson(data);

  try {
    if (!kIsWeb) {
      PushNotification().showNotification(data: result);
    } else {
      Pushy.notify(result.title ?? "", result.body ?? "", data);
    }
  } catch (e) {
    Pushy.notify(result.title ?? "", result.body ?? "", data);
  }

  Pushy.clearBadge();
}

Future main() async {
  await _initApp();
  runApp(Application());
}

Cannot receive Push Notifications after Update/Upgrade

Hi there,

Please could you assist me.
I have upgraded my Flutter SDK and Pushy library (pushy_flutter: ^1.1.2) recently and now I no longer receive any push notifications. I am using the flutter pushy demo code exactly.

I see this error in my logs.
I/flutter (18015): Pushy: Error retrieving handle for Flutter callbacks

I/flutter (18015): null
D/Pushy   (18015): PushyJobService: Sending keep alive
D/InputMethodManager(18015): prepareNavigationBarInfo() DecorView@3954443[MainActivity]
D/InputMethodManager(18015): getNavigationBarColor() -855310
D/ViewRootImpl@898714a[MainActivity](18015): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager(18015): prepareNavigationBarInfo() DecorView@3954443[MainActivity]
D/InputMethodManager(18015): getNavigationBarColor() -855310
D/SurfaceView(18015): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{4a8f8bb V.E...... ........ 0,0-1080,2094} of ViewRootImpl@898714a[MainActivity]
D/OpenGLRenderer(18015): eglDestroySurface = 0xe6f8d8e0, 0xcb413800
D/ViewRootImpl@898714a[MainActivity](18015): Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x5 surface={false 0} changed=false
D/Pushy   (18015): PushyJobService: Sending keep alive

I have tried everything I possibly can think of. The notifications were working before on iOS and Android. Any advice/guidance/assistance would be much appreciated.

Flutter doctor:

[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H2, locale en-ZA)
    • Flutter version 1.20.4 at /Users/ryangodlonton-shaw/Documents/development/tools/flutter
    • Framework revision fba99f6cf9 (2 weeks ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /Users/ryangodlonton-shaw/Library/Android/sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

• No issues found!

Triggering actions within the app with 1.1.x

We used to have code like this using 1.0.x which would allow us to dispatch actions view redux when a pushy was received, however with 1.1.x this needs to live outside of a widget so how would I go about getting the context when a pushy is received when the app is in the foreground.

Pushy.setNotificationListener((data) {
        RemoteNotifications.handleMessage(
          data,
          handler: "onMessage",
          store: store,
        );
      });

Thanks

Notification is not received when the android app is killed

This is a very common scenario. Most of the apps like what's app , Skype , LinkedIn and all receiving notification when app is closed .

And notification doesn't rely on app being open or close .

But when it comes to pushy notification doesn't arrive when app is closed . Is there anything we can do to receive notification when app is killed ?

Unhandled Exception: MissingPluginException(No implementation found for method notify on channel me.pushy.sdk.flutter/methods)

Hi, I'm now facing an issue which my application not able to push notification only when the app has killed. It only works well when the app is running or I minimize the application. From the debug console, I can see the apps has received the notification successfully

[+8340 ms] D/Pushy ( 6919): Received push for package com.afabasia.afab
[ ] D/Pushy ( 6919): {message=Hello Hell}
[ +8 ms] D/Pushy ( 6919): Invoking push receiver via reflection: me.pushy.sdk.flutter.internal.PushyInternalReceiver
[ ] D/Pushy ( 6919): Handling notification in Flutter background isolate
[ +4 ms] I/flutter ( 6919): Pushy: _isolate() received notfication
[ +2 ms] I/flutter ( 6919): Pushy notification received: {__json: {"message":"Hello Hell"}, message: Hello Hell}
[ ] I/flutter ( 6919): Received notification: {__json: {"message":"Hello Hell"}, message: Hello Hell}

but when I calling the function Pushy.notifiy(...); , it show me this error

[ +14 ms] E/flutter ( 6919): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method notify on channel me.pushy.sdk.flutter/methods)

I have tried the pushy demo project and it works everything well, only in my project, it can't push the notification out when the app is killed. Did I miss out configure something so that my app can't get the Pushy library after the app get killed?

Below are the result of my flutter doctor -v

[√] Flutter (Channel stable, 1.22.1, on Microsoft Windows [Version 10.0.18363.1440], locale en-MY)
• Flutter version 1.22.1 at C:\Users\zhanm\Desktop\flutter sdk\flutter_1.22.1\flutter
• Framework revision f30b7f4db9 (6 months ago), 2020-10-08 10:06:30 -0700
• Engine revision 75bef9f6c8
• Dart version 2.10.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\zhanm\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\zhanm\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.

[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.54.3)
• VS Code at C:\Users\zhanm\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0

[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

Connect exception: (0) - java.net.UnknownHostException: mqtt-XXXXXX.pushy.io

I'm experiencing an issue using Pushy Flutter SDK on Android that sometimes Pushy will encounter a connection exception and couldn't reconnect, and notifications sent after that will not be received. My phone is not in battery saving mode when this happened.

Here is what's in logcat: (the numbers and tokens are redacted)

2021-01-22 14:22:36.811 2859-2897/app.package.name D/Pushy: Connected successfully (sending keep alive every 300 seconds)
2021-01-22 14:22:37.113 2859-5277/app.package.name D/Pushy: Connection lost
2021-01-22 14:22:37.122 2859-2897/app.package.name D/Pushy: PushyJobService: Connecting...
2021-01-22 14:22:37.123 2859-2897/app.package.name D/Pushy: Broker: ssl://mqtt-XXXXXXX.pushy.io:443
2021-01-22 14:22:37.123 2859-2897/app.package.name D/Pushy: Device Token: XXXXXXX
2021-01-22 14:22:37.123 2859-2897/app.package.name D/Pushy: Device Auth Key: XXXXXXX... [truncated]
2021-01-22 14:22:37.143 2859-2897/app.package.name D/Pushy: Connect exception:  (0) - java.net.UnknownHostException: mqtt-XXXXXXX.pushy.io
2021-01-22 14:22:37.144 2859-2897/app.package.name D/Pushy: Reconnecting in 1000ms

After that last line there was no more logs printed. It looks like Pushy did not reconnect, because when I then send a notification the app didn't receive it, nothing was printed in logcat, and it's shown as pending delivery on the dashboard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.