logo
down
shadow

No sound or vibration in Android push notifications in Expo Client


No sound or vibration in Android push notifications in Expo Client

By : Softosis
Date : October 17 2020, 06:10 PM
Does that help i found a solution for the sound and vibration it's not the best as i said i'm new to RN but still it works ( i used this: "create Channel Android Async" )
code :
async componentWillMount() {
    let result = await Permissions.getAsync(Permissions.NOTIFICATIONS);
    if (result.status === "granted" && this.state.switchStatus) {
    // i add this :
      if (Platform.OS === 'android') {
  Notifications.createChannelAndroidAsync('chat-messages', {
    name: 'Chat messages',
    sound: true,
    vibrate: true,
  });
}
      console.log("Notification permissions granted.");

      this.setNotifications();
    } else {
      console.log("No Permission", Constants.lisDevice);
    }

    this.listenForNotifications(); 
  }

  getNotification(date) {

    const localNotification = {
      title: `Notification at ${date.toLocaleTimeString()}`,
      body: "N'oubliez pas de prendre tes medicament", 
      ios: {

        sound: true 
      },

      android: {
       "channelId": "chat-messages" //and this
            }
    };
    return localNotification;
  }
  setNotifications() {
    Notifications.cancelAllScheduledNotificationsAsync();

    for (let i = 0; i < 64; i++) {
      //Maximum schedule notification is 64 on ios.
      let t = new Date();
      if (i === 0) {
        t.setSeconds(t.getSeconds() + 1);
      } else {
        t.setMinutes(t.getMinutes() + 1 + i * 1); // 15 Minutes
      }
      const schedulingOptions = {
        time: t 
      };
      Notifications.scheduleLocalNotificationAsync(
        this.getNotification(t),
        schedulingOptions
      );
    }
  }
  listenForNotifications = () => {
    Notifications.addListener(notification => {
      console.log("received notification", notification);
    });
  };


Share : facebook icon twitter icon
How to mute sound and vibration for all notifications in Android 5.0+?

How to mute sound and vibration for all notifications in Android 5.0+?


By : hufsa
Date : March 29 2020, 07:55 AM
help you fix your problem Since nobody came up with a solution, I'm going to answer my own question.
It seems that there is really no way to achieve what I wanted, at least with the latest Android versions. So I ended up doing the following ugly workaround:
Android: Push Notification has no Sound/Vibration/Light

Android: Push Notification has no Sound/Vibration/Light


By : Fábio Caldas
Date : March 29 2020, 07:55 AM
Does that help I'm not getting sound, vibration or light when receiving a notification. Can someone please tell me what I'm missing? , Custom Sound for Push Notification
code :
notification.sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.pop);
    Notification notification = mBuilder.build();
    notification.defaults = Notification.DEFAULT_ALL;
    mNotifyMgr.notify(mNotificationId, notification);
notification.sound = Uri.parse("android.resource://" + getPackageName() + "/" +R.raw.pop);
notification.defaults |= Notification.DEFAULT_VIBRATE;
Expo Push Notifications not popping in Android phones (Floating Notifications)

Expo Push Notifications not popping in Android phones (Floating Notifications)


By : user1656164
Date : March 29 2020, 07:55 AM
Hope that helps I've finally made it work using Expo.Notifications.createChannelAsync using priority: "max" and when sending a message add channelId: "mychannel".
Android notifications not making sound or vibration

Android notifications not making sound or vibration


By : Joshua Berger
Date : March 29 2020, 07:55 AM
it helps some times Don't forget to enable the vibration setting for ringtone and notifications. Go to Settings -> Sound. Check "Sound an vibration".
How Instagram sends push-notifications to iOS devices without vibration (new likes) and with vibration (replies)?

How Instagram sends push-notifications to iOS devices without vibration (new likes) and with vibration (replies)?


By : Wilhelm Wedernikow
Date : March 29 2020, 07:55 AM
To fix the issue you can do Assuming you've properly registered for push notifications in the AppDelegate (
Related Posts Related Posts :
  • NativeModule: AsyncStorage is null, with @RNC/AsyncStorage
  • Place an 'x' on top corner of image, for deleting (React Native)
  • Undefined is not an object(evaluating '_expo.default.Constants')
  • Secure way to use remote API keys with react-native?
  • react navigation - DrawerNavigator for Header Menu icon inside TabNavigator-> StackNavigator
  • How to change the default font family of the entire react native app
  • Is it possible to row-reverse in a 2 columns Flatlist?
  • Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'in
  • undefined is not an object (evaluating '_expo.Permission.askAsync')
  • Adding watermark to video/picture after capture using react-native-camera
  • Couldn't read accelerometer and gyro from sensortag using react-native
  • bundling failed: Error: While resolving module `metro/src/lib/bundle-modules/HMRClient`
  • ApolloClient from apollo-boost attemped to assign to readonly property
  • How can i delete message on click of bubble touch? React Native Gifted chat library
  • How to fix java.lang.Double cannot be cast to java.lang.String in React Native
  • Is there a way to tell if the user has been touching the screen in react native?
  • How to get the URI scheme of any app for AppLinks/universal linking?
  • textAlign justify property not working in react native
  • react native expo is there a custom date time picker work on iOS and android
  • FlatList renderItem error, TypeError: undefined (evaluating 'item.id')
  • scroll to specific div using webview in react native
  • react native scroll view doesnt scroll in android
  • How to change the background color in Drawer navigation in react-navigation
  • Upgrade Expo CLI have unknown error --assetPlugins
  • React native hooks break hot reloading?
  • Object into Components
  • React Native camera on iOS is showing blank screen
  • Expo: UIManager throwing warning UIManager
  • I can't create stripe token using createTokenWithCard() in React Native
  • App stop working when Image Picker is opened in React Native
  • React native multi-column FlatList insert banner
  • How do I change device location?
  • How to fix React-Native Error 'could not unzip gradle-5.4.1-all.zip'
  • Type Error : Method.bind is not a function
  • How to fix 'boost/operators.hpp' file not found' error in react-native
  • React native image, dynamic require
  • Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'
  • How to properly select a value from items.index ingested as json
  • react-navigation drawer how to set props and style to route components?
  • Async await with map function, promise.all not working
  • Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure fu
  • How can I send a message from the WebView to React Native?
  • How to change the default background colour for mapView.callout using react-native-maps?
  • React-Native-Maps: How to use animateCamera and setCamera
  • How to show custom view in bottom of the screen for entire application (like every screen) in react native
  • React Art <Text /> rotation
  • flow throws errors with a new react-native init project
  • how to pass back props to Parent Component in wix Navigation
  • Select multiple element on react native onpress in flatlist
  • React navigation open openDrawer() not working
  • Getting the current routeName in react navigation
  • How to fix 'ReactNative:Cannot run program' error
  • Error: Object are not valid as a react child?
  • Facing issue " Failed to install the app. Make sure you have the Android development environment " in react na
  • React-native installing required CocoaPods dependencies stuck
  • React Native and React Navigation — How to get screen title to show in header and bottom tab navigator to also show
  • errors after running expo start
  • Failed to build react native app after linking with ble-plx
  • Push Notifications don't work after deploying Expo app to Apple store's TestFlight
  • BoxShadow in react-native
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk