EvanBacon / expo-native-firebase

🔥 Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database 🚨
211 stars 41 forks source link

How do I create a notification channel ? #16

Closed shubhamdeol closed 5 years ago

shubhamdeol commented 5 years ago
createNotificationChannel = () => {
    const channel = new firebase.notifications.Android.Channel('test-channel', 'Test Channel', firebase.notifications.Android.Importance.Max)
      .setDescription('My apps test channel');
    // Create the channel
    firebase.notifications().android.createChannel(channel);
  }

I am using this code, but getting this warning "undefined not an object(evaluating 'new _expoFirebaseApp.default.notifications.Android.Channel'

shubhamdeol commented 5 years ago

should I try this

import { android } from 'expo-firebase-notifications';

const notification = new android.createChannel(channel);

this also didn't work

EvanBacon commented 5 years ago

A little weird at the moment but try:


import { statics } from 'expo-firebase-notifications';

/* statics.Android.Channel */

const { Android } =  statics;

/* Create a channel */

const channel = new Android.Channel(
  'test-channel', 
  'Test Channel', 
  Android.Importance.Max
).setDescription('My apps test channel');

firebase.notifications().android.createChannel(channel);