question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Data null in background

See original GitHub issue

Bug

Data payload null if in background In Background

{"chat": "us0jXE4qG9gPuSMJF0xzHTH", "collapse_key": "com.hallopet.user", "data": {}, "finish": [Function finish], "foreground": false, "from": "1095807157509", "google.delivered_priority": "normal", "google.message_id": "0:1598946632974825%eaee66e3eaee66e3", "google.original_priority": "normal", "google.sent_time": 1598946632971, "google.ttl": 2419200, "object": "chat", "object_id": "us0jXE4qG9gPuSMJF0xzHTH", "userInteraction": true}

In Active App

{"color": null, "data": {"chat": "us0jXE4qG9gPuSMJF0xzHTH", "object": "chat", "object_id": "us0jXE4qG9gPuSMJF0xzHTH"}, "finish": [Function finish], "foreground": true, "id": "1860630111", "message": "Pp", "sound": null, "title": "cepw4xh5n8", "userInteraction": false}

Environment info

react-native info output:

System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 1.31 GB / 7.91 GB
  Binaries:
    Node: 14.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    Android Studio: Version  4.0.0.0 AI-193.6911.18.40.6626763
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Library version: ^5.1.0

Describe what you expected to happen:

  1. I will data is not null like Active App notification attached

Reproducible sample code

import React, { Component } from 'react'
import Route from './src/Route';
import { Root } from 'native-base';
import AsyncStorage from '@react-native-community/async-storage'
import axios from 'axios'
import SplashScreen from 'react-native-splash-screen'
import { AppState, Text, View, Image, StatusBar, Dimensions, StyleSheet, Linking, Platform } from 'react-native'
import { API_URL, BASE_COLOR, SOCKET_URL } from 'react-native-dotenv'
import Icon from 'react-native-vector-icons/AntDesign';
import NotifService from './NotifService'; // use example of this library
import NavigationService from './NavigationService';  // use example of this library
import ADD_DATA from './redux/notification/action';
import storeNotification from './redux/notification/store';
import * as storeUser from 'react-native-simple-store';
import PushNotificationIOS from "@react-native-community/push-notification-ios";

import { Provider} from 'react-redux';
import store from './redux/store';

export class App extends Component {
    constructor(props) {
        super(props);
        this.state = {
            showRealApp: true
        };
        this.notif = new NotifService(
            this.onRegister.bind(this),
            this.onNotification.bind(this),
        );
    }
    onRegister(token) {
        AsyncStorage.setItem('notification:token', token.token);
    }
    onNotification(notif){
        console.log(notif);
    }
    componentDidMount() {
        SplashScreen.hide();
    }
    render() {
            return (
                <Root>
                    <Provider store={store}>
                        <Route />
                    </Provider>
                </Root>
            );
    }
}

export default App

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14

github_iconTop GitHub Comments

4reactions
gibrandevcommented, Oct 1, 2020

@Dallas62 fixed in version 6.0.0, can i close this issue

1reaction
gibrandevcommented, Sep 2, 2020

In Active not click

{"badge": undefined, "data": {"chat": "vYxVH1ADEhuSLFOsVwo6niGUnqiiqyKN", "gcm.message_id": "1599034437820075", "google.c.a.e": "1", "notificationId": "691D52E8-DFFE-4B39-A31F-1B711073AA17", "object": "chat", "object_id": "vYxVH1ADEhuSLFOsVwo6niGUnqiiqyKN", "remote": true, "userInteraction": 0}, "finish": [Function finish], "foreground": true, "id": undefined, "message": {"body": "Pp", "title": "gibrandev"}, "soundName": undefined, "title": undefined, "userInteraction": false}

In Background + Click

{"badge": undefined, "data": {"chat": "vYxVH1ADEhuSLFOsVwo6niGUnqiiqyKN", "gcm.message_id": "1599034488426493", "google.c.a.e": "1", "notificationId": "37BA650A-5458-480F-94C4-9452608C2272", "object": "chat", "object_id": "vYxVH1ADEhuSLFOsVwo6niGUnqiiqyKN", "remote": true, "userInteraction": 1}, "finish": [Function finish], "foreground": false, "id": undefined, "message": {"body": "Pp", "title": "gibrandev"}, "soundName": undefined, "title": undefined, "userInteraction": true}
Read more comments on GitHub >

github_iconTop Results From Across the Web

My data gets null when app is relaunched after being at ...
Just avoid this issue entirely by storing your values using SharedPreferences inside the onPause and onDestroy method overrides.
Read more >
Solved: Formatting Background Color Conditional - Blank, N...
Hello, I am try to conditionally format the background of my visuals based off of a measure then a scoring level of 0...
Read more >
Conditional formatting Cell background color with Null Values
Hi,. I have a requirement to conditionally format the cell background color and using the below formula. if COUNT([Item])=[CA_Count] THEN 'Green'.
Read more >
Background-image: null | WordPress.org
Hi,. I've got this in my website's code, is it normal for the background image url to be “null”? <style type=”text/css”>#lyte_Uq1o6w5zHUQ ...
Read more >
NSUserDefaults might be NULL when app is launched
We have hundreds of iPad and iPhone users; but in some iPhone users (a very very small portion), all values in [NSUserDefaults standardUserDefaults]...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found