Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native notification with custom template for Android

I've been trying to find a react-native module which allows custom notification templates for Android. I've tried https://github.com/neson/react-native-system-notification and https://github.com/zo0r/react-native-push-notification but it seems that they do not allow a custom template for the android notification - only setting the default template values. I am trying to achieve something similar to this:

enter image description here

like image 248
Vasil Dininski Avatar asked Oct 26 '16 20:10

Vasil Dininski


1 Answers

You can you use react-native-music-control library to move your music controls at the notification panel.

You can customize it as you like with the following method. Read documentation for more.

  MusicControl.setNowPlaying({ 
title: 'Billie Jean',
artwork: 'https://i.imgur.com/e1cpwdo.png', // URL or RN's image require()
artist: 'Michael Jackson',
album: 'Thriller',
genre: 'Post-disco, Rhythm and Blues, Funk, Dance-pop',
duration: 294, // (Seconds)
description: '', // Android Only
color: 0xFFFFFF, // Notification Color - Android Only
date: '1983-01-02T00:00:00Z', // Release Date (RFC 3339) - Android Only
rating: 84, // Android Only (Boolean or Number depending on the type)
notificationIcon: 'my_custom_icon' // Android Only (String), Android Drawable resource name for a custom notification icon
})

enter image description here

like image 127
Hassan Raza Avatar answered Oct 23 '22 11:10

Hassan Raza