Android: notification with origin:received when app is in background

Please provide the following:

  1. SDK Version: 36.0.2
  2. Platforms: Android

SDK Version: 37.0.7
Expo-cli version: 3.18.2

Hi!
I’m always getting push notification with origin: received in android managed app even when app is in background (normally you should have origin:selected when pressing on notification).
It started happening even for old apps, so it could be something related to Expo push server.

Steps to reproduce:

  • Create a managed app via expo-cli.
  • Add notification listener (as shown below)

My App.js file with all relevant code is looking like this (all other files are set as defaults):

import React, { useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Notifications } from 'expo'

export default function App() {
  useEffect(() => {
    async function body() {
        const newToken = await Notifications.getExpoPushTokenAsync()
        console.log('token', newToken)    
    }

    body()

    Notifications.addListener(n => {
      console.log('notification', n)
    })
  }, [])

  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Start app on android phone (tested on Samsung S10+), put app in background (not closing it) and send notification to yourself.

Expected behaviour: no notification events are triggered until notification is selected.
Actual behaviour: notification event is triggered with origin: received.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.