Vasil Dininski
Vasil Dininski

Reputation: 2418

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

Upvotes: 18

Views: 1196

Answers (2)

AliRehman7141
AliRehman7141

Reputation: 993

You can also try this react-native-track-player package it will help you to show controls event the phone is locked.

Upvotes: 0

Hassan Raza
Hassan Raza

Reputation: 82

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

Upvotes: 1

Related Questions