eddieowens / react-native-boundary

Native implementation of geofencing/region monitoring

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

events not firing in android 10 in react-native 0.61.5

axeljeremy7 opened this issue · comments

commented

Code I use:

import React from 'react'
import {Component} from 'react';
import {
    View, Text, Dimensions,
} from 'react-native';
import Boundary, {Events} from 'react-native-boundary';

const {height} = Dimensions.get('window');

export default class Home extends Component {
    constructor(props) {
        super(props);

        this.state = {
            onEnter: false,
            onExit: false,
        };
    }

    componentDidMount() {
        console.log({state: this.state});
        Boundary.add({
            lat: 42.285232,
            lng: -85.626622,
            radius: 50, // in meters
            id: "Station",
        })
            .then(() => console.log("success!"))
            .catch(e => console.error("error :(", e));

        Boundary.on('onEnter', id => {
            this.setState(prev => ({...prev, onEnter: true}));
            console.log(`ON ENTER ${id}!!`);
        });

        Boundary.on('onExit', id => {
            this.setState(prev => ({...prev, onExit: true}));
            console.log(`ON EXIT ${id}!!`)
        });
    }

    componentWillUnmount() {

        // Remove the events
        Boundary.off(Events.ENTER);
        Boundary.off(Events.EXIT);

        Boundary.remove('Station')
            .then(() => console.log('Goodbye Station :('))
            .catch(e => console.log('Failed to delete Station :)', e))
    }

    render() {
        return (
            <View style={{
                backgroundColor: '#EAF0F6',
                height: height,
                justifyContent: 'flex-start',
                alignItems: 'flex-start',
            }}>
                <Text style={{fontSize: 18, color: '#707070'}}>{JSON.stringify(this.state)}</Text>
            </View>
        );

    }
}

the logs i only get.

 LOG  {"state": {"onEnter": false, "onExit": false}}
 LOG  Goodbye Station :(
 LOG  success!

Facing the same. Did you able to resolve it ? @axeljeremy7 axeljeremy7

commented

Facing the same. Did you able to resolve it ? @axeljeremy7 axeljeremy7

Sadly not, I just create a new functionality with the background location to simulate this.

have found the solution?

Hi Guys, I am able to run it on Android 10 with API 29, it creates problem with API 30. I have tested it. Thanks,

On Sep 1, 2020, at 11:18 AM, jawwad22 @.***> wrote: have found the solution? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#54 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQIO5IFV5IEAMDDZOB7ARTSDUGFLANCNFSM4LEQUGXQ.

Can you share your code, please?

Hi Guys, I am able to run it on Android 10 with API 29, it creates problem with API 30. I have tested it. Thanks,

On Sep 1, 2020, at 11:18 AM, jawwad22 @.***> wrote: have found the solution? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#54 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQIO5IFV5IEAMDDZOB7ARTSDUGFLANCNFSM4LEQUGXQ.

anyone found solution with this?