awesome push notification with fcm - flutter

i am lost at some point,
i am try to figure out how to use this plugin plugin here
what should use to reply this:
this is working on fcm fine but i am trying to switch from fcm because of the reply like whatsApp
FirebaseMessaging.onMessage.listen
FirebaseMessaging.onMessageOpenedApp.listen
FirebaseMessaging.instance
.getInitialMessage()
.then((RemoteMessage message) {
});

you can use action button:
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
title: 'Action button title',
body: 'Simple body',
),
actionButtons: [
NotificationActionButton(
key: "REPLY",
label: "Reply",
autoCancel: true,
enabled: true,
buttonType: ActionButtonType.InputField,
icon: "resource://drawable/logo"),
],
);

Related

flutter awesome notification give function to button

i want to give some action to my notification button but i cannot get it to work, i want to give cancel download from my dio service
here is my code
notification.createNotification(
content: NotificationContent(
//simgple notification
id: id,
channelKey: 'basic', //set configuration wuth key "basic"
title: title,
body: body,
payload: {
"name": "layar",
},
icon: 'resource://drawable/ic_downloading',
autoDismissible: false,
notificationLayout: NotificationLayout.ProgressBar,
progress: progress,
fullScreenIntent: true,
backgroundColor: MyThemes.colorBlue,
),
actionButtons: [
NotificationActionButton(
key: "cancel",
label: "Cancel",
actionType: ActionType.DismissAction,
),
NotificationActionButton(
key: "pause",
label: "Pause",
),
],
);

How can I play this function in background services in flutter

How can I play this function in background services in flutter?
Kindly elaborate or also attach documentation or video link if possible.
I'm trying to play some music from a dependency named assets_audio_player.
I tried to use the didAppLifeCycleChange but in this way, I was facing a new
issuer it plays 2 songs. now I want to play songs directly in the background does not matter
app is in background or in foreground
void setupPlaylist() async {
await audioplayer.open(
showNotification: true,
Playlist(audios: [
Audio(
'assets/1.mp4',
metas: Metas(
title: "Bazz aa by YS",
artist: 'Talha',
image: const MetasImage.network(
'https://www.musicgrotto.com/wp-content/uploads/2021/09/best-songs-of-all-time-graphic-art.jpg'),
),
),
// Audio(SongsList[2].,
// metas: Metas(
// title: "Bazz01",
// artist: 'Talha',
// )),
Audio.network(
'https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview125/v4/09/17/bb/0917bbe1-58c3-6252-d00e-9b70d42ef5dc/mzaf_2269500085377778268.plus.aac.p.m4a',
metas: Metas(
id: 'Online',
title: 'Online',
artist: 'Florent Champigny',
album: 'OnlineAlbum',
// image: MetasImage.network('https://www.google.com')
image: const MetasImage.network(
'https://i.dawn.com/large/2021/09/61399fb500900.png'),
),
),
Audio(
'assets/2.mp4',
metas: Metas(
title: "Bazz aa by YS",
artist: 'Talha',
image: const MetasImage.network(
'https://www.musicgrotto.com/wp-content/uploads/2021/09/best-songs-of-all-time-graphic-art.jpg'),
),
),
Audio('assets/3.mp4',
metas: Metas(
title: "Bazz aa song",
artist: 'Talha',
image: const MetasImage.network(
'https://www.thenews.com.pk/assets/uploads/updates/2021-12-27/920292_6757937_hgjhj_updates.jpg'),
)),
Audio('assets/1.mp4',
metas: Metas(
title: "Bazz03",
artist: 'Talha',
image: const MetasImage.network(
'https://www.thenews.com.pk/assets/uploads/updates/2021-12-27/920292_6757937_hgjhj_updates.jpg'),
)),
]),
autoStart: true,
loopMode: LoopMode.playlist,
);
}

Add Action to AndroidNotificationDetails

I would like to add a button to my notification, I was able to get it displayed but I can't find the documentation on how to add an action to the button press
const androidNotification = AndroidNotificationDetails(
'Bla', 'Bla',
icon: 'ic_bg_service_small',
ongoing: true,
actions: [AndroidNotificationAction("stop", "Stop")]);
flutterLocalNotificationsPlugin.show(
888,
'MyService',
'bla',
const NotificationDetails(android: androidNotification),
);
You need to use this plugin to make action in notifications https://pub.dev/packages/awesome_notifications
void _showNotificationWithButton() {
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
title: 'Simple Notification',
body: 'Simple body'),
actionButtons: <NotificationActionButton>[
NotificationActionButton(key: 'yes', label: 'Yes'),
NotificationActionButton(key: 'no', label: 'No'),
],
);
}

flutter mailto and url_launcher to not work

I want to use email
and I use these two packages:
url_launcher: ^6.0.20
mailto: ^2.0.0
and I use this code :
launchMailto() async {
final mailtoLink = Mailto(
to: ['to#example.com'],
cc: ['cc1#example.com', 'cc2#example.com'],
subject: 'mailto example subject',
body: 'mailto example body',
);
await launch('$mailtoLink');
}
but it not work
can anyone help me please how can I use mailto in my project?
and by the way when I change my android manifest, my grade can't run and my project destroy
Try below code
sendMail() async {
const url = 'mailto:youremailid.com';
launchUrl(
Uri.parse(url),
),
}
Your Widget:
ElevatedButton (
child: Text(
' Send Mail',
style: TextStyle(fontSize: 15, color: Colors.blue),
),
onPressed: sendMail,
),

How to land the user on a different page while using AutoTabsScaffold and BottomNavigationBar?

I'm using Auto_Route for routing in my application and AutoTabsScaffold makes it easier. But by default, the user is navigated to the first page in the bottom navigation bar but I want it to be navigated to third page by default. How can I do that?
Here's a snippet of the code:
AutoTabsScaffold(
routes: [
A(),
B(),
C(),
D(),
E(),
],
bottomNavigationBuilder: (_, tabsRouter) {
return BottomNavigationBar(
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.black,
selectedItemColor: const Color(0XFFEAF8FF),
unselectedItemColor: Colors.grey,
currentIndex: tabsRouter.activeIndex,
onTap: tabsRouter.setActiveIndex,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.groups_outlined), label: ""),
BottomNavigationBarItem(icon: Icon(Icons.search), label: ""),
BottomNavigationBarItem(
icon: Icon(Icons.catching_pokemon), label: ""),
BottomNavigationBarItem(
icon: Icon(Icons.library_add_check_outlined), label: ""),
BottomNavigationBarItem(
icon: Icon(Icons.person_outline), label: ""),
],
);
I want the user to land on C() and not A(). How can I do that? Thanks in advance.
Had the same issue.
I use auto_route package in my project.
We can see that current index depend on tabsRouter.activeIndex property.
So, I just added to the preferred route initial: true, property.
Like this:
CustomRoute(
path: '/',
page: MainScreen,
name: 'MainScreenRoute',
guards: [AuthGuard],
transitionsBuilder: TransitionsBuilders.fadeIn,
children: [
AutoRoute(
path: 'wallet',
page: WalletScreen,
),
AutoRoute(
path: 'trades',
page: TradesScreen,
),
AutoRoute(
path: 'market',
initial: true,
page: MarketScreen,
),