Code Monkey home page Code Monkey logo

react-native-kontaktio's Introduction

react-native-kontaktio npm version

Cross-platform React Native module for detecting beacons with Android and iOS devices.

Kontakt.io SDK Versions of newest release:

OS SDK Version
Android 7.0.6
iOS 3.0.25

Advantages

  • Works with any beacon (because the Kontakt.io SDK wraps the native beacon libraries (while adding more) - no Kontakt.io SDK API key is necessary.
  • Especially useful with Kontakt.io beacons because additional information like the unique id (on the back of each beacon), the battery power level and others are available and get synchronized with your Kontakt.io online panel.
  • Highly customizable configurations (e.g. for setting arbitrary monitoring intervals on Android)

Setup

API Documentation

Examples

Extensive Example

Minimal TypeScript Example

A minimal example (created with React Native v0.69.5 and TypeScript) with the default configuration and no specifically set regions. Thus, the default region everywhere (i.e. all beacons) is automatically used.

  1. Follow the setup instructions carefully for iOS and Android to install react-native-kontaktio for both platforms.
  2. Start a new React Native TypeScript project (npx react-native init BeaconTest --template react-native-template-typescript) and replace App.tsx with the example code below.
  3. Run the app on a real device (iOS or Android - not a simulator)
  4. Check the React Native logs to see console statements containing incoming beacon signals.
import React, { useEffect } from 'react';
import {
  Alert,
  DeviceEventEmitter,
  NativeEventEmitter,
  PermissionsAndroid,
  Platform,
  SafeAreaView,
  StatusBar,
  StyleSheet,
  Text,
  View,
} from 'react-native';

import Kontakt, { KontaktModule } from 'react-native-kontaktio';
const {
  connect,
  init,
  startDiscovery,
  startRangingBeaconsInRegion,
  startScanning,
} = Kontakt;

const kontaktEmitter = new NativeEventEmitter(KontaktModule);

const isAndroid = Platform.OS === 'android';

/**
 * Android Marshmallow (6.0) and above need to ask the user to grant certain permissions.
 * This function does just that.
 */
const requestLocationPermission = async () => {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
      {
        title: 'Location Permission',
        message:
          'This example app needs to access your location in order to use bluetooth beacons.',
        buttonNeutral: 'Ask Me Later',
        buttonNegative: 'Cancel',
        buttonPositive: 'OK',
      }
    );
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      return true;
    } else {
      // permission denied
      return false;
    }
  } catch (err) {
    console.warn(err);
    return false;
  }
};

const beaconSetup = async () => {
  if (isAndroid) {
    // Android
    const granted = await requestLocationPermission();
    if (granted) {
      await connect();
      await startScanning();
    } else {
      Alert.alert(
        'Permission error',
        'Location permission not granted. Cannot scan for beacons',
        [{ text: 'OK', onPress: () => console.log('OK Pressed') }],
        { cancelable: false }
      );
    }
  } else {
    // iOS
    await init();

    /**
     * Will discover Kontakt.io beacons only
     */
    await startDiscovery();

    /**
     * Works with any beacon(also virtual beacon, e.g. https://github.com/timd/MactsAsBeacon)
     * Requires user to allow GPS Location (at least while in use)
     *
     * change to match your beacon values
     */
    await startRangingBeaconsInRegion({
      identifier: '',
      uuid: 'A4826DE4-1EA9-4E47-8321-CB7A61E4667E',
      major: 1,
      minor: 34,
    });
  }

  // Add beacon listener
  if (isAndroid) {
    /* works with any beacon */
    DeviceEventEmitter.addListener(
      'beaconsDidUpdate',
      ({ beacons, region }) => {
        console.log('beaconsDidUpdate', { beacons, region });
      },
    );
  } else {
    /* works with Kontakt.io beacons only */
    kontaktEmitter.addListener('didDiscoverDevices', ({ beacons }) => {
      console.log('didDiscoverDevices', { beacons });
    });

    /* works with any beacon */
    kontaktEmitter.addListener('didRangeBeacons', ({ beacons, region }) => {
      console.log('didRangeBeacons', { beacons, region });
    });
  }
};

const App: React.FC = () => {
  useEffect(() => {
    Promise.resolve().then(beaconSetup);

    return () => {
      // remove event listeners
      if (isAndroid) {
        kontaktEmitter.removeAllListeners('beaconsDidUpdate');
      } else {
        kontaktEmitter.removeAllListeners('didDiscoverDevices');
        kontaktEmitter.removeAllListeners('didRangeBeacons');
      }
    };
  }, []);

  return (
    <SafeAreaView>
      <StatusBar barStyle="dark-content" />
      <View style={styles.wrapper}>
        <Text style={styles.title}>react-native-kontaktio Example</Text>
        <Text>Check console.log statements</Text>
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  wrapper: {
    height: '100%',
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    paddingVertical: 10,
    fontSize: 30,
  },
});

export default App;

Note (March 2020): The example in the Example/ folder is a bit outdated. If you want to try to run the example app anyway, here are some instructions to do so:

  1. Clone this repository, connect an Android and/or Apple device to your computer and have some (Kontakt.io) beacons nearby.

  2. Open a terminal window, bash to the Example/ folder, run npm install and start the react-native server

    $ cd react-native-kontaktio/Example
    $ npm install
    $ npm start
  3. Build the example and run it on your device. The app will appear under the name KontaktIoSimpleTest:

    • Android:

      $ react-native run-android
    • iOS

      $ react-native run-ios

Further notes

  • Beacons support is part of Android versions 4.3 and up. * So far the lowest Android version this library was tested on was a device with Android 4.4.2.
  • A physical device must be used for testing and some beacons (Kontakt.io beacons to be able to use all features).
  • If some BLE Beacons are filtered out by the scan on Android 12+, therefore not returned in the list of beacons, try this:
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:remove="android:usesPermissionFlags" />
    With the neverForLocation android:usesPermissionFlags, some BLE beacons are filtered from the scan results. |More information about this on issue #121.

ToDo:

  • Update Android Eddystone feature:

    • Add multiple Eddystone namespaces, i.e. add function setEddystoneNamespaces
    • Add Eddystone Frames Selection configuration option

Contribute

Test library changes locally

  1. Fork and clone this repository

  2. Run yarn to install the dependencies

  3. Make code changes

  4. Delete lib folder if it exists and run yarn tsc to compile the TypeScript files in the the lib folder.

  5. In the package.json file of an example app point to the this directory, e.g.

    "dependencies": {
      ...
      "react-native-kontaktio": "../react-native-kontaktio"
    },
  6. Build and run on a real device

Upgrade to a new version of the Kontakt.io SDK

Android

In build.gradle file change the version in the following line

implementation "io.kontakt.mvn:sdk:7.0.6"

iOS

  1. Go to the Kontakt.io SDK releases page and download the newest version of KontaktSDK.framework.zip.
  2. Replace the ios/KontaktSDK.framework folder of this library with the Cocoapods/KontaktSDK/iOS/KontaktSDK.xcframework/ios-arm64_armv7/KontaktSDK.framework folder which you find in the unzipped folder structure.

react-native-kontaktio's People

Contributors

alzavio avatar andrekovac avatar dependabot[bot] avatar exkazuu avatar gloix avatar jampueroc avatar jdegger avatar jdpigeon avatar jkaos92 avatar jonaswho avatar martinpoulsen avatar nathander avatar nicholasc avatar nielsotten avatar pkandrashkou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-kontaktio's Issues

undefined is not an object

I have an RN project using react 16.0.0-alpha.12 and react-native 0.48.4. When I import Kontakt, the app aborts on start with the error:

undefined is not an object (evaluating 'KontaktModule.disconnect')

MinimalExample.android.js — How to run it?

Hi all, I am trying to run the minimal android example using Eddystone beacons. Unfortunately, nothing comes out on the console. Am I missing something?

import React, { Component } from 'react';
import { View, DeviceEventEmitter } from 'react-native';

import Kontakt from 'react-native-kontaktio';
const { connect, startScanning } = Kontakt;

export default class MinimalExample extends Component {
  componentDidMount() {
    connect()
      .then(() => startScanning())
      .catch(error => console.log('error', error));

    DeviceEventEmitter.addListener(
      'eddystonesDidUpdate',
      ({ eddystones, namespace }) => {
        console.log('eddystonesDidUpdate', eddystones, namespace);
      }
    );
  }

  render() {
    return <View />;
  }
}

Thank you in advance.

lib not working as expected for iOS 13.3

hi have integrated lib with my project ,its working for for android and even for ios 12.4.5 (iPhone 6s) but not working in iPhone X (os 13.3),

error:

dyld: Library not loaded: @rpath/KontaktSDK.framework/KontaktSDK
Referenced from: /private/var/containers/Bundle/Application/18F90787-C083-4D06-9C58-9094014C7D50/BCnDemo.app/BCnDemo
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/18F90787-C083-4D06-9C58-9094014C7D50/BCnDemo.app/Frameworks/KontaktSDK.framework/KontaktSDK: code signature invalid for '/private/var/containers/Bundle/Application/18F90787-C083-4D06-9C58-9094014C7D50/BCnDemo.app/Frameworks/KontaktSDK.framework/KontaktSDK'

any thing i am missing ?

same issue with ios native sample project i faced
thanks in advance

Support for iOS

Missing support for iOS. Any idea when the support will be added?

const connect already defined

I have

 import { connect } from 'react-redux';

And then:

import Kontakt from 'react-native-kontaktio';
const {  connect, configure, disconnect. startScanning, setBeaconReagons ... 

But I get an ESLint error: connect is already defined. And rightly so, no?

I tried

import { connect as connectKontakt, configure, disconnect, startScanning, setBeaconReagons...

But that gives me: Possible Unhandled Promise Rejection (reactNativeKontaktio.connect) is not a function.

What should/can I do?

Please see https://stackoverflow.com/questions/51589676/es6-how-to-import-already-defined-in-another-js-package

Simple README example fix

MinimalExample.ios.js . calls the wrong function
should be startScanning instead of startDiscovery

thanks a million for all your work!

P:)

Unnecessary permissions requested

Investigate whether the following permissions may be removed because they are not (yet) supported:

  • <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
  • <uses-permission android:name="android.permission.INTERNET" />
  • <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Beacon disconnecting continuously

I have beacons and using your sdk we have developed one application
for tracking car trip. our main goal is once car driver enters into the
car then mobile app includes your kontact sdk that detects beacon and
starts tracking automatically. for achieving this functionality we have
used Enter and Exit event from your sdk But sometimes driver already
into the car and we got exit event. Sometimes beacon is near to
phone then still I am getting exit event it should not. I must get
Exit event once beacon goes far from the beacon.

null is not an object during the iOS app compilation

Hi.
I installed the library following the installation doc, but unfortunatly i got some errors after the compilation on iOS.
Can someone help me solve this issue ?

2019-07-18 15:14:46.616 [error][tid:com.facebook.react.JavaScript] null is not an object (evaluating 'KontaktModule.stopDiscovery')
2019-07-18 15:14:46.616115+0200 ImmaginaCervia[4153:769615] null is not an object (evaluating 'KontaktModule.stopDiscovery')
2019-07-18 15:14:46.653 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2019-07-18 15:14:46.653138+0200 ImmaginaCervia[4153:769615] Module AppRegistry is not a registered callable module (calling runApplication)
2019-07-18 15:14:46.639 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: null is not an object (evaluating 'KontaktModule.stopDiscovery')
2019-07-18 15:14:46.673219+0200 ImmaginaCervia[4153:769601] Unhandled JS Exception: null is not an object (evaluating 'KontaktModule.stopDiscovery')

stop scanning

I bought few iBeacon online and tried your example, yes it detect all the beacons. However, it did not keep scanning until I want to stop, it stop itself , I put a counter in beaconsDidUpdate it stop increase until 20+ to 30+ only, and each increment need about 4s, how to set to 1s.

let counter = 0;
componentDidMount() {
    connect()
      .then(() => startScanning())
      .catch(error => console.log('error', error));

    DeviceEventEmitter.addListener(
      'beaconsDidUpdate',
      ({ beacons, region }) => {
        counter++;
        console.log('Last scan ' + moment().format('h:mm:ss a'));
        console.log('beaconsDidUpdate', beacons, region, counter);
      },
    );
  }

Error using Expo SDK in React Native project

Hi,
in my React Native project your sdk works great, but when i install Expo sdk (https://expo.io/) inside the project and launch it on my devices it appear this error on iOS:
img_9302

And undefined is not a object (evaluating 'KontaktModule.disconnet) on Android.
Have you got any solution to avoid this problem?

the beacon manager is not connected

At some stage everything was working ok, but now I get (again) an error

I somehow fixed it before but cannot find what I'm doing wrong now.

My code is: (with the real api key)

setKontaktIo() {
  const regionKontakt = {
    identifier: 'Noam Kontakt Beacons',
    uuid: 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'
    // major: 1  no major, all majors will be detected
    // no minor provided: will detect all minors
  };

  connect(
    'myapikey_changed_here_because_were_public',
    [IBEACON, EDDYSTONE]
  )
    .then(() =>
      configure({
        scanMode: scanMode.BALANCED,
        scanPeriod: scanPeriod.create({
          activePeriod: 6000,
          passivePeriod: 20000
        }),
        activityCheckConfiguration: activityCheckConfiguration.DEFAULT,
        forceScanConfiguration: forceScanConfiguration.MINIMAL,
        monitoringEnabled: monitoringEnabled.TRUE,
        monitoringSyncInterval: monitoringSyncInterval.DEFAULT
      })
    )
    .then(() => setBeaconRegions([regionKontakt]))
    .then(() => setEddystoneNamespace())
    .catch(error => console.log('appmain kontakt error', error));

  // Beacon listeners
  DeviceEventEmitter.addListener(
    'beaconDidAppear',
    ({ beacon: newBeacon, region }) => {
      console.log('beaconDidAppear', newBeacon, region);
      if (this.props.currentBeacon.beaconID !== newBeacon.uniqueId) {
        const tempBeacon = this.props.currentPlace.xsnearby.find(beacon => {
          beacon.beacon.beaconID === newBeacon.uniqueId;
        });
        if (tempBeacon !== undefined && tempBeacon !== null) {
          console.log('setting currentBeacon to found point in data');
          this.props.setCurrentBeacon(tempBeacon.beacon);
        }
      }
    }
  );
  DeviceEventEmitter.addListener(
    'beaconDidDisappear',
    ({ beacon: lostBeacon, region }) => {
      console.log('beaconDidDisappear', lostBeacon, region);
      if (this.props.currentBeacon.beaconID === lostBeacon.uniqueId) {
        Alert.alert(
          'Beacon Disappear',
          'You left: ' + this.props.currentBeacon.msg,
          [{ text: 'OK' }],
          { cancelable: true }
        );
      }
    }
  );
}

startKontaktIoScan() {
  console.log('startKontaktIoScan called');
  startScanning()
    .then(() => console.log('started scanning'))
    .catch(error => console.log('[startScanning] error:\n', error));
}

componentDidMount() {
    this.setKontaktIo();
    this.startKontaktIoScan();
}

I get two errors, the first together with the next one:

[startScanning] error:
Error: Did you forget to call connect() or did the connect() call fail? The beacon manager is not connected.
at createErrorFromErrorData (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:121)
at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:78
at MessageQueue.__invokeCallback (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:398)
at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:137
at MessageQueue.__guardSafe (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136)
at debuggerWorker.js:70

The callback startScanning() exists in module KontaktBeacons, but only one callback may be registered to a function in a native module.
handleException @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\ExceptionsManager.js:63
handleError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\InitializeCore.js:69
reportFatalError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\polyfills\error-guard.js:42
__guardSafe @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:316
invokeCallbackAndReturnFlushedQueue @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136
(anonymous) @ debuggerWorker.js:70

full react-native android app here: https://github.com/pashute/Noam/tree/feature/v098c

Run KontaktBeacons in background thread instead of main thread

React Native will eventually, in future versions, demand that plugins opt in or out of running on the main thread. I get this Warning when running react-native-kontaktio in RN 0.52.0:

Module KontaktBeacons requires main queue setup since it overrides constantsToExportbut doesn't implementrequiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

** EXPORT FAILED ** When building app on AppCenter

App build fails when building using AppCenter with following error :
error: exportArchive: Failed to verify bitcode in KontaktSDK.framework/KontaktSDK: error: Cannot extract bundle from

I am not sure why is this happening. Previous builds were successful but in last few days builds are failing because of this error even though I was not using this package in recent work at all.

Here is my configuration : XCode versions: 10.2/10.1 (both failing) react-native-cli: 2.0.1 react-native: 0.57.8

Obtaining beacon's MAC address on IOS

Implemented this library effectively in android but facing some issues with IOS. I understand that it is not possible to obtain the Mac address of the Eddystone beacon.

However, it is possible to retrieve the beacon's advertisementData in IOS because the beacon's manufacturer I am working with can assist in setting the data on the beacons. From the IOS documentation I haven't seen a way to obtain advertisementData so I'm not sure.

Apart from this method, is there any other ways for IOS to match specific beacons across all phones (Unique id similar to Mac address). I understand UUID is generated for each unique phone upon scanning the beacon, however it is different for every phone despite it being the same beacon, hence it can't work for my use case as I require it to be scanned and recognised across multiple phones.

Or is it possible to set a static UUID, Major and Minor for each beacon?

Also, how do I get Major, Minor and battery levels? so far I've only tried didDiscoverEddystones and it gives me the following:

  • accuracy
  • identifier (assuming its UUID base on format)
  • instanceId
  • namespace
  • proximity
  • rssi
  • updatedAt

Thank you for all your help and support thus far, sorry for the swarm of questions. Stay safe and healthy everyone!

error: package android.support.annotation does not exist | cannot find symbol class Nullable

Hi there,
I've started a fresh react-native project and got the following error:

error: package android.support.annotation does not exist
error: cannot find symbol class Nullable

This is a picture of the error:
image

These are my dependencies:

"dependencies": {
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-kontaktio": "^2.6.2",
    "react-native-switch-toggle": "^1.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.8.0",
    "eslint": "^6.1.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.8.6"
  },

I've tried to use npm & yarn and both gave the same error.

Any idea on how to solve this issue?

Thanks

Support cocoapods

I now had to manually edit the Podspec to this:

require 'json'
package = JSON.parse(File.read(File.join(__dir__, '../package.json')))

Pod::Spec.new do |s|
  s.name         = "KontaktBeacons"
  s.version      = package['version']
  s.summary      = "KontaktBeacons"
  s.description  = <<-DESC
                   Cross-platform React Native module for detecting beacons with Android and iOS devices.
                   DESC
  s.homepage     = ""
  s.license      = "MIT"
  s.homepage      = "https://github.com/Artirigo/react-native-kontaktio"
  s.author             = { "author" => "[email protected]" }
  s.platform     = :ios, "7.0"
  s.source       = { :git => "https://github.com/Artirigo/react-native-kontaktio.git", :tag => "master" }
  s.source_files  = "ios/**/*.{h,m}"
  s.requires_arc = true


  s.dependency "React"

end

This seems to work, would be great if this could be added to the repo and the pod link script would integrate cocoapods support as well.

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I am experiencing two issues. The first error is the one described in the title of the post. It's triggered when the Debug JS Remotely is activated. By disabling it, I get me another error. This time is an alert. It is coming from the initialization of the app and is the catch from startDiscovery() but I have no clue if the alert is caused by the first error.

Has anyone experienced this issue with an iOS built?

"react": "16.2.0",
"react-native": "0.52.1",
"react-native-kontaktio": "^2.0.4"

Support for monitoring

Hey, great job on this library!

Any idea on when support for monitoring will be available?
I'd love to switch to this library instead of react-native-beacons-android. But monitoring beacons is kinda key for my use-case

isConnected fails i connect() has not been called

Since we have multiple places in our codebase where connect() can be called from, we would like a way to check whether or not the proximity manager has been initialised.
I tried using isConnected(), but it throws an exception if called before connect().

Am I doing it wrong or should isConnected() also do a check for beaconProximityManager == null?

Looking for Light sensor data from iBEEKS (or Eddy stone with light sensor)

Hi,
We are looking for a solution to fetch the light sensor data along with the telemetry object from an Eddystone beacon which already supports light sensor (Bluvision iBEEK)

We assumes that the telemetry object inside the beacons should provide the additional datas such as light and x,y axis movements. Any suggestions would save us as we are already fed up with the light sensor data!!!

Thanks in Advance,
Arun

Add possibility to create custom ScanPeriods and ForceScanConfigurations in configure.

Not added for now because it's not stable yet.


Some details:

  • These values have dependencies within and between each other which hence demand more effort right now to test thoroughly
  • For example the error of number 3 of the list below 1) does not occur while setting the configuration, but when starting to scan and 2) is somehow not catched by the try-catch-loop inside the startScanning method of the ScanManager class and causes the app to crash (Perhaps have to try to include a nested try-catch inside onServiceReady here..)

Some of the value dependencies:

  1. The active scan period must be a positive value equal or longer than 3000 ms
  2. The passive scan period must be a positive value equal or higher than 2000ms or equal to 0.
  3. Activity check period must be shorter than active scan period #(kontaktio/kontakt-android-sdk#145) , i.e. the first argument activePeriod of scanPeriod has to be greater than the second argument checkPeriod of activityCheckConfiguration.

gradlew clean and gradle fail after trying to create a release

Caused due to a coding error. Not a react-native-kontaktio issue.

Configure project :react-native-kontaktio
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':react-native-kontaktio'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V

It happened both to me and to another programmer (Omar Espinosa) on the other side of the world!

We put the keystore in myproj/android/app and ever since we get this error. Moving the keystore didn't help. adding compileOptions to use java 8.1 didn't help either.

My app cannot see simulated beacons

I have little problem with detect simulated beacons. I try simulate ibeacon from my second phone by Beacon Simulator on android. But my app can't see these beacons, but when I simulate beacon from my macbook, my app see this beacon.

I don't have phisical beacon yet, so I don't tested it.

Maybe have you any idea what I doing wrong ?

Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

We are getting this error in Bugsnag. I am not sure wether it has to be resolved by this library or in React Native. Do you have any idea why this happens?

java.lang.RuntimeException ·CallbackImpl.java:32
Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

CallbackImpl.java:32 · com.facebook.react.bridge.CallbackImpl.invoke
PromiseImpl.java:32 · com.facebook.react.bridge.PromiseImpl.resolve
KontaktModule.java:107 · com.artirigo.kontaktio.KontaktModule$1.onServiceReady
InternalProximityManager.java:72 · com.kontakt.sdk.android.ble.manager.internal.InternalProximityManager$1.onServiceConnected
LoadedApk.java:1453 · android.app.LoadedApk$ServiceDispatcher.doConnected

screen shot 2017-07-01 at 12 11 16

Compilation fails on a project using RN 0.48.x

Here is a reproduction repository: https://github.com/exKAZUu/react-native-kontaktio-issue20
react-native run-ios shows the following errors.

In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:8:
In file included from ../../react-native/React/Modules/RCTEventEmitter.h:10:
In file included from /Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16: error: redefinition of 'RCTMethodInfo'
typedef struct RCTMethodInfo {
               ^
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:2:
../../react-native/React/Base/RCTBridgeModule.h:54:16: note: previous definition is here
typedef struct RCTMethodInfo {
               ^
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:8:
In file included from ../../react-native/React/Modules/RCTEventEmitter.h:10:
In file included from /Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:58:3: error: typedef redefinition with different types ('struct (anonymous struct at /Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16)' vs 'struct RCTMethodInfo')
} RCTMethodInfo;
  ^
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:2:
../../react-native/React/Base/RCTBridgeModule.h:58:3: note: previous definition is here
} RCTMethodInfo;
  ^
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:8:
In file included from ../../react-native/React/Modules/RCTEventEmitter.h:10:
In file included from /Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/exkazuu/Projects/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:65:11: warning: duplicate protocol definition of 'RCTBridgeModule' is ignored [-Wduplicate-protocol]
@protocol RCTBridgeModule <NSObject>
          ^
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.m:1:
In file included from /Users/exkazuu/Projects/AwesomeProject/node_modules/react-native-kontaktio/ios/KontaktBeacons.h:2:
../../react-native/React/Base/RCTBridgeModule.h:65:11: note: previous definition is here
@protocol RCTBridgeModule <NSObject>
          ^
1 warning and 2 errors generated.



** BUILD FAILED **

"didDiscoverDevices" not being triggered on iOS

I've followed the instructions from the example, but for whatever reason the didDiscoverDevices event is not being triggered on iOS. I'm using my Mac to simulate a beacon (have tried both the BeaconEmitter and MactsAsBeacon apps). I'm running iOS 13.4 and version 0.61.5 of React Native.

Let me know if there's anything I might've missed. Thanks!

simulate a beacon detected

Could you add a feature to simulate a detected beacon (or a few), and also give a mock of the data received in answer to detected beacons? I need this for my ios app which is crashing when a beacon is detected, and I'm sure there are many developers who could use this.

Or perhaps there's a way to do this that you can tell me?

A regular beacon simulator emitting a simulated beacon is not enough because the Kontakt-io outputs an extra internal field with the kontakt id.

Android beacon scanning not working

Hi

I was trying out this library instead of beacon manager, in IOS its all working good, but in android, beacons are not showing up. Btw I'm not using Kontaktio beacons.

How to obtain the InstanceID for a Eddystone Beacon in Android?

When I use eddystoneDidUpdate the namespace looks like this:
{"identifier": "Everywhere", "instanceId": "Any instance ID", "namespace": "f7826da6bc5b71e0893e", "secureNamespace": null}

I want to obtain the instanceId but like you see just show "Any Instance ID", is a problem of configuration?

Android is not detecting iBeacons

Hi, I implement the example that is in Readme file and android setup file "manully config" and I can´t see my beacon in the console,I think the library is not working or what I'm doing wrong? because another apps in the same phone works perfectly with the beacon that I have, I don´t know if they use this library but works, both on iPhone and Android.

I'm using:
Phone: Motorola G4
*SO: Android 7.0
*RN: 61.2
*Beacon spec: BLE iBeacon Bluecharms
*react-native-kontaktio: 2.7.2

Any solution?

Android Beacon detection is not working when App close.

Hi,

I have set region and start scanning in android. it's work fine when app in foreground. The data of beacon getting the results. but when App is closed, And after I checked the beacon is not connect.

Can you help me what is mistake in android.

Thanks.

Scanning of Telemetry data is inconsistent.

When scanning for Eddystone beacons, the telemetry data received is inconsistent. Sometimes it would be able to receive the TLM information, while most of the time it receives null. This is not the case when I've tested with other beacon scanning apps as they are always able to retrieve the TLM data, so I would think it is most likely NOT an issue with the beacon but possibly with the library.

Does anyone have any experience with this?

Thank you for your help :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.