Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Show Big Picture Style Android Notifications #112

Closed
dereklakin opened this issue Oct 17, 2018 · 4 comments
Closed

Can't Show Big Picture Style Android Notifications #112

dereklakin opened this issue Oct 17, 2018 · 4 comments

Comments

@dereklakin
Copy link

dereklakin commented Oct 17, 2018

I can successfully show both standard and BigText style notifications, but when I try to show a BigPicture style notification I get an platform exception:

E/flutter (24066): [ERROR:flutter/shell/common/shell.cc(182)] Dart Error: Unhandled exception: E/flutter (24066): PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null) E/flutter (24066): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7) E/flutter (24066): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18) E/flutter (24066): <asynchronous suspension> E/flutter (24066): #2 FlutterLocalNotificationsPlugin.show (file:///C:/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-0.3.9/lib/src/flutter_local_notifications.dart:95:20) E/flutter (24066): <asynchronous suspension> E/flutter (24066): #3 _HomePageState._tempShowNotification (file:///C:/Personal/Projects/MedicineManager/medicine_manager_flutter/lib/home_page/home_page.dart:325:19) E/flutter (24066): <asynchronous suspension> E/flutter (24066): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14) E/flutter (24066): #5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30) E/flutter (24066): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) E/flutter (24066): #7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9) E/flutter (24066): #8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7) E/flutter (24066): #9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9) E/flutter (24066): #10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12) E/flutter (24066): #11 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11) E/flutter (24066): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19) E/flutter (24066): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22) E/flutter (24066): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7) E/flutter (24066): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7) E/flutter (24066): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7) E/flutter (24066): #17 _invoke1 (dart:ui/hooks.dart:153:13) E/flutter (24066): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:107:5)

My code looks like this:

    var directory = await getApplicationDocumentsDirectory();
    var notifications = ServiceLocator.instance.flutterLocalNotificationsPlugin;
    var androidDetails = AndroidNotificationDetails(
      'ChannelId',
      'ChannelName',
      'Channel Description',
      importance: Importance.Max,
      priority: Priority.Max,
      style: AndroidNotificationStyle.BigPicture,
      styleInformation: BigPictureStyleInformation(
        '${directory.path}/${ImageAssets.headerImage}',
        BitmapSource.FilePath,
      ),
    );
    var iOSDetails = IOSNotificationDetails();
    var notificationDetails = NotificationDetails(androidDetails, iOSDetails);
    notifications.show(
        0, 'title', 'body', notificationDetails,
        payload: 'Payload');
  }
@MaikuB
Copy link
Owner

MaikuB commented Oct 22, 2018

found the issue and have a fix on the way but github seems to have some issues at the moment so once that's resolved, i'll be able to release an update with the fix

MaikuB added a commit that referenced this issue Oct 23, 2018
fix issue #112 around displaying big picture notifications on Android
@MaikuB
Copy link
Owner

MaikuB commented Oct 23, 2018

Published version 0.4.0 that has the fix so will close this issue. Feel free to re-open if you still run into problems

@MaikuB MaikuB closed this as completed Oct 23, 2018
@dereklakin
Copy link
Author

All working now. Thank you!

@macroday
Copy link

macroday commented Jul 8, 2019

Could I able to show big picture image from network? Is that possible?

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

No branches or pull requests

3 participants