Local Push Notification II - Flutter
HTML-код
- Опубликовано: 1 окт 2024
- Click here to Subscribe to Johannes Milke: www.youtube.co...
► Source code: github.com/Joh...
► Buy My Courses: johannesmilke....
► Follow Twitter: in...
Last video: • Local Push Notificatio...
Share this video, write a comment and hit the like button. To never miss anything, subscribe to my RUclips channel (Activate the bell, to never miss upcoming
Flutter videos): bit.ly/Johannes...
#JohannesMilke
► Overview of all my Flutter projects: bit.ly/Johannes...
FOLLOW & VISIT ME on my social media:
Twitter: / johannesmilke
Facebook: / johannes.milke.37
Instagram: / johannesmilke
► Top Flutter Playlists #JohannesMilke: bit.ly/FlutterP...
******************
► Subscribe JohannesMilke on RUclips
bit.ly/Johannes...
*********************
► Watch more Flutter videos #JohannesMilke: bit.ly/FlutterV...
If you find this video useful, LIKE & SHARE this video to help other people who also learn Flutter :)
#Flutter #FlutterTutorials #FlutterDev #JohannesMilke
Copyright song "Corporate Technology" by scottholmesmusic.com
Why at utils i have problem with( imageInfo,_) asycn {
- Try This ^^
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
Future saveImage(BuildContext context, Image image) {
final completer = Completer();
image.image.resolve(ImageConfiguration()).addListener(
ImageStreamListener((ImageInfo image, bool synchronousCall) async {
final byteData = await image.image.toByteData(format: ImageByteFormat.png);
final pngBytes = byteData.buffer.asUint8List();
final fileName = pngBytes.hashCode;
final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/$fileName';
final file = File(filePath);
await file.writeAsBytes(pngBytes);
completer.complete(filePath);
}));
return completer.future;
}
@@ellee8615 thank you, I had the same problem
Hi Johannes your tutorials are really good. I want to ask you one question we are storing the images in application directory. How and when we should delete them? as they will consume space.
Great Tutorial! Thanks. How scheduled (ie.. at certain time of the day and weekdays) push notification can be made? Looking fwd for a tutorial
good rüstü, you are good way to learn flutter bro hello turkey :)
Did you did so?
Hi Milke, seem that there are many errors with new version? Like:
Could you help to fix that ?
error: Undefined name 'BitmapSource'. (undefined_identifier at [meoi] lib\local_notications_helper.dart:51)
error: The named parameter 'style' isn't defined. (undefined_named_parameter at [meoi] lib\local_notications_helper.dart:58)
error: The argument type 'String' can't be assigned to the parameter type 'AndroidBitmap'. (argument_type_not_assignable at [meoi] lib\local_notications_helper.dart:82)
error: The named parameter 'largeIconBitmapSource' isn't defined. (undefined_named_parameter at [meoi] lib\local_notications_helper.dart:83)
error: Undefined name 'BitmapSource'. (undefined_identifier at [meoi] lib\local_notications_helper.dart:83)
@Nguyen Dinh Thun @Johannes Milke
i have the same issue, please how do you fix that ?
@@m.s.8939 please check the asset image
@@DinhThucNguyen yes i check it and it's valid..
image.resolve(ImageConfiguration()).addListener((imageInfo, _) async { not working
Hello again! thank you for the video :D, I think IMHO this package has a update so I can't load pictures unless I saved at drawable Android folder and I can load them through DrawableResourceBitmap instead of FilePathAndroidBitmap, when I try loading icon & largeIcon by filePath also these parameters were changed to xAndroidBitmap) the stacktrace says file not found. I'm glad with your videos, regards!
Thanks for the video!!!!! Can you also demonstrate how to use the Scheduled notification function?
Thanks for the tutorial! What would be the best way to trigger a Local Notification from an API? Mixing Cloud Notifications and Local Notifications? If so it would be really awesome to have this kind of tutorial.
Genius! A background fcm that triggers a local notification with images! I'll try it :)
@@fabioburkard I tried, but couldn't trigger the local notification with fcm when the app is closed. Please update me if you succeed :)
@@woshitomtom Same here... there's a long (and old) discussion here: github.com/firebase/quickstart-android/issues/41
Maybe using a channel and registering directly, but will probably fail (see Muhammad Babar's answer here: stackoverflow.com/questions/37711082/how-to-handle-notification-when-app-in-background-in-firebase/42279260#42279260 )
I'll try channels when I buy some time, so if it work I'll create a github project - but, honestly, seems impossible so far.
(Y)
Thanks for the tutorial! Just wanted to ask, do you have any tutorials on app architecture?
[solved ]
Thanks for the video but :
I get this in utils. dart
error: The argument type 'Future Function(dynamic, dynamic)' can't be assigned to the parameter type 'ImageStreamListener'. (argument_type_not_assignable at [projectname33] lib/utils.dart:11)
- Try This :)
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
Future saveImage(BuildContext context, Image image) {
final completer = Completer();
image.image.resolve(ImageConfiguration()).addListener(
ImageStreamListener((ImageInfo image, bool synchronousCall) async {
final byteData = await image.image.toByteData(format: ImageByteFormat.png);
final pngBytes = byteData.buffer.asUint8List();
final fileName = pngBytes.hashCode;
final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/$fileName';
final file = File(filePath);
await file.writeAsBytes(pngBytes);
completer.complete(filePath);
}));
return completer.future;
}
- Try This ^^
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
Future saveImage(BuildContext context, Image image) {
final completer = Completer();
image.image.resolve(ImageConfiguration()).addListener(
ImageStreamListener((ImageInfo image, bool synchronousCall) async {
final byteData = await image.image.toByteData(format: ImageByteFormat.png);
final pngBytes = byteData.buffer.asUint8List();
final fileName = pngBytes.hashCode;
final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/$fileName';
final file = File(filePath);
await file.writeAsBytes(pngBytes);
completer.complete(filePath);
}));
return completer.future;
}
How can we send this directly from Firebase? I saw you other videos but didn't find how to send images, only text from Firebase
Awesome videos, Johannes! Really a great source of learning for a flutter beginner :D I do have a question though, what exactly is the BuildContext used for in saveImage for example?
Great.
Sir please make a video on local notification in background.
Is there any particular reason you have not even once clicked on a notification and shown how you receive the payload?
Hi, Thanks for the tutorial ! Just wanted to ask, can we also add images or icons in the IOS notification or ?
May I ask a question?
Do you know how to play custom sound with notification when the app is closed?
Amazing content. Subscribed
Thankyou brother for the tutorial :)
Thank you Johannes!!! Needed this..
Awesome videos
Hello sir thank you for this video
but can we push notification when app not open?
@@HeyFlutter Yes but in firebase not message notification is possible, i was already use thank you
@@HeyFlutter i want to make image notification in local and even show if app is closed.
@@HeyFlutter I want to make a notification 45 minutes after the user has done a specific thing in the app, even if the app is closed, and it would have 2 buttons and a large image. Is that possible with Flutter?
The thing I was looking for 😍
@@HeyFlutter