react-native-beacons-manager icon indicating copy to clipboard operation
react-native-beacons-manager copied to clipboard

Add Android RSSI filter customization method

Open peterdeka opened this issue 7 years ago • 4 comments

Hi, great job with this library, any plan to introduce the Android's setSampleExpirationMilliseconds method? I think it's just 3 lines of code but could be very useful to enhance the experience during BLE based navigation. I can fork and implement, even if i'm not an experienced Android dev if you think it could be useful.

peterdeka avatar May 24 '17 23:05 peterdeka

I implemented more general RSSI filter choice, also with averaging period customization. Branched it in https://github.com/peterdeka/react-native-beacons-manager/tree/setfilter tested working (maybe we could use some parameter validation based on filter type). I currently branched from the latest release, but applying to current HEAD implies only copy/pasting the android java module and adding typing to the android js lib file.

peterdeka avatar May 25 '17 01:05 peterdeka

Nice could you please submit a PR?

MacKentoch avatar May 26 '17 17:05 MacKentoch

Could you publish a new version that includes this change?

peterjuras avatar Jun 11 '17 12:06 peterjuras

Testing this functionality added to the current release (not master HEAD) breaks the iOS build for the way i exported the constants for the filter types. The relative code is in lib/module.android.js:

const ARMA_RSSI_FILTER=beaconsAndroid.ARMA_RSSI_FILTER;
const RUNNING_AVG_RSSI_FILTER=beaconsAndroid.RUNNING_AVG_RSSI_FILTER;

When building on iOS the constants are not exported from the android code and the js code fails at runtime.

As i'm no expert of ReactNative, do you think the best solution is hardcoding the same values as those defined in the android code or is there a more elegant way? I can do that and PR if you give me advice.

peterdeka avatar Jun 22 '17 09:06 peterdeka