@rodrigo7/react-native-beacons-manager 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.flowconfig +21 -0
  2. package/.nvmrc +1 -0
  3. package/.prettierignore +4 -0
  4. package/.prettierrc +12 -0
  5. package/.vscode/settings.json +24 -0
  6. package/LICENSE +21 -0
  7. package/README.md +246 -0
  8. package/ReactNativeBeaconsManager.podspec +13 -0
  9. package/android/.project +17 -0
  10. package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
  11. package/android/build.gradle +108 -0
  12. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  13. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  14. package/android/gradle/wrapper/gradle.properties +2 -0
  15. package/android/gradlew +160 -0
  16. package/android/gradlew.bat +90 -0
  17. package/android/src/main/AndroidManifest.xml +8 -0
  18. package/android/src/main/java/com/mackentoch/beaconsandroid/BeaconsAndroidModule.java +457 -0
  19. package/android/src/main/java/com/mackentoch/beaconsandroid/BeaconsAndroidPackage.java +29 -0
  20. package/index.js +10 -0
  21. package/ios/RNiBeacon/RNiBeacon/ESSBeaconScanner.h +41 -0
  22. package/ios/RNiBeacon/RNiBeacon/ESSBeaconScanner.m +204 -0
  23. package/ios/RNiBeacon/RNiBeacon/ESSEddystone.h +117 -0
  24. package/ios/RNiBeacon/RNiBeacon/ESSEddystone.m +352 -0
  25. package/ios/RNiBeacon/RNiBeacon/ESSTimer.h +72 -0
  26. package/ios/RNiBeacon/RNiBeacon/ESSTimer.m +107 -0
  27. package/ios/RNiBeacon/RNiBeacon/RNiBeacon.h +16 -0
  28. package/ios/RNiBeacon/RNiBeacon/RNiBeacon.m +467 -0
  29. package/ios/RNiBeacon/RNiBeacon.xcodeproj/project.pbxproj +290 -0
  30. package/jsconfig.json +9 -0
  31. package/lib/next/module.types.js +169 -0
  32. package/lib/next/new.module.android.js +451 -0
  33. package/lib/next/new.module.ios.js +176 -0
  34. package/package.json +65 -0
  35. package/typings/index.d.ts +174 -0
  36. package/typings.json +7 -0
  37. package/yarn-error.log +4182 -0
package/.flowconfig ADDED
@@ -0,0 +1,21 @@
1
+ [ignore]
2
+
3
+ [include]
4
+
5
+ [libs]
6
+
7
+ [options]
8
+ module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
9
+
10
+
11
+ suppress_type=$FlowIssue
12
+ suppress_type=$FlowFixMe
13
+ suppress_type=$FlowFixMeProps
14
+ suppress_type=$FlowFixMeState
15
+ suppress_type=$FixMe
16
+
17
+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
18
+ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
19
+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
20
+ suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
21
+ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 8
@@ -0,0 +1,4 @@
1
+ **/*.json
2
+ **/*.txt
3
+ **/*.xml
4
+ **/*.svg
package/.prettierrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "all",
4
+ "bracketSpacing": true,
5
+ "jsxBracketSameLine": false,
6
+ "singleQuote": true,
7
+ "overrides": [],
8
+ "printWidth": 80,
9
+ "useTabs": false,
10
+ "tabWidth": 2,
11
+ "parser": "babylon"
12
+ }
@@ -0,0 +1,24 @@
1
+ // Placez vos paramètres dans ce fichier pour remplacer les paramètres par défaut et les paramètres utilisateur.
2
+ {
3
+ // coding style and xp:
4
+ "editor.tabSize": 2,
5
+ "editor.insertSpaces": true,
6
+
7
+ "editor.autoClosingBrackets": true,
8
+
9
+ // search:
10
+ "search.exclude": {
11
+ "node_modules": true,
12
+ "bower_components": true,
13
+ "jspm_packages": true,
14
+ ".git": true,
15
+ "flow-typed": true,
16
+ "__snapshots__": true
17
+ },
18
+
19
+ // flow
20
+ "javascript.validate.enable": false,
21
+ "flow.useNPMPackagedFlow": true,
22
+ "flow.pathToFlow": "node_modules/.bin",
23
+ "javascript.format.enable": false
24
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Erwan DATIN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ [![npm](https://img.shields.io/npm/l/react-native-beacons-manager.svg)](https://github.com/MacKentoch/react-native-beacons-manager)
2
+ [![npm](https://img.shields.io/npm/v/react-native-beacons-manager.svg)](https://www.npmjs.com/package/react-native-beacons-manager)
3
+ [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/react-native-beacons-manager/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
4
+
5
+ # react-native-beacons-manager
6
+
7
+ ![logo](./images/RN-iBeacon.png)
8
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMacKentoch%2Freact-native-beacons-manager.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FMacKentoch%2Freact-native-beacons-manager?ref=badge_shield)
9
+
10
+ `react-native-beacons-manager`: add beacon technology in your React Native application for both iOS and Android.
11
+
12
+ This repository is born to keep alive and up to date these 3 original awesome:
13
+ - [ibeacon for android](https://github.com/mmazzarolo/react-native-beacons-android)
14
+ - [ibeacon for iOS](https://github.com/frostney/react-native-ibeacon)
15
+ - [eddyStone for iOS](https://github.com/google/eddystone/blob/master/tools/ios-eddystone-scanner-sample)
16
+
17
+ If you want to know more about just have a look at [my medium article](https://medium.com/@erwan.datin/mmazzarolohow-to-play-with-ibeacons-in-a-react-native-application-5cef754b2edc#.e2bvgplvy).
18
+
19
+ If you want to test with a `simulated beacon`, there is a useful free application on `android`: [beaconsimulator](https://play.google.com/store/apps/details?id=net.alea.beaconsimulator) and `MacOS`: [BeaconEmitter](https://github.com/lgaches/BeaconEmitter)
20
+
21
+ ## Install (iOS and Android)
22
+
23
+ > Ensure to have NodeJS >= v6.x.
24
+ >
25
+ > You must run on **real devices** (*don't forget to active Bluetooth when running*).
26
+
27
+ **Mobile Version compatibility:**
28
+
29
+ > - **iOS** `minimum version`
30
+ > - 8.0
31
+ > - **Android** `minimum version`
32
+ > - 21 (*alias LOLLIPOP*)
33
+
34
+
35
+ ### 1. get modules
36
+ *via npm:*
37
+ ```javascript:
38
+ npm install react-native-beacons-manager
39
+ ```
40
+ *or via yarn:*
41
+ ```javascript:
42
+ yarn add react-native-beacons-manager
43
+ ```
44
+ ### 2. link to your application
45
+
46
+ ```javascript
47
+ react-native link react-native-beacons-manager
48
+ ```
49
+ ### 3.a configuration specific to iOS
50
+
51
+ If you plan to:
52
+ - `only range beacons` no configuration needed (`react-native init` already did the job for you), or just check that you already have `WhenInUse` authorization declared in your `info.plist`:
53
+ - ![ios: request when in use authorization](./images/plistRequireWhenInUseAutorization.png)
54
+
55
+
56
+ - `monitor` then default authorization won't be enough:
57
+ - in your `info.plist`, add `Privacy - Location Always Usage Description` key defined (*empty value or not. It is better to define a value to a custom / more user-friendly message*).
58
+ ![ios: request when in use authorization](./images/plistRequireAlwaysUseAutorization.png)
59
+
60
+ - If your `Info.plist` contains a `NSBluetoothPeripheralUsageDescription` key, you have to specify an associated text to avoid being rejected.
61
+
62
+ - **use background mode** check [this documentation](./BACKGROUND_MODES.md)
63
+
64
+ ### 3.b configuration specific to Android
65
+
66
+ Nothing (lucky Android :smile:).
67
+
68
+ Just don't forget to activate
69
+ - Bluetooth service (*all android version*)
70
+ - Location service (*android < 7: beacon detection won't work on android 6 if location service is off*)
71
+
72
+ ## 4. usage
73
+
74
+ >NOTE: If simple examples below don't help you as much as you wanted, [check detailed documentation depending on use-case + code samples here](https://github.com/MacKentoch/react-native-beacons-manager/tree/master/examples/samples#detailed-documentation--sample-code)
75
+
76
+ ### 4.a iOS
77
+
78
+ #### Simple example
79
+
80
+ ```javascript
81
+ import { DeviceEventEmitter } from 'react-native'
82
+ import Beacons from 'react-native-beacons-manager'
83
+
84
+ // Define a region which can be identifier + uuid,
85
+ // identifier + uuid + major or identifier + uuid + major + minor
86
+ // (minor and major properties are numbers)
87
+ const region = {
88
+ identifier: 'Estimotes',
89
+ uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
90
+ };
91
+
92
+ // Request for authorization while the app is open
93
+ Beacons.requestWhenInUseAuthorization();
94
+
95
+ Beacons.startMonitoringForRegion(region);
96
+ Beacons.startRangingBeaconsInRegion(region);
97
+
98
+ Beacons.startUpdatingLocation();
99
+
100
+ // Listen for beacon changes
101
+ const subscription = DeviceEventEmitter.addListener(
102
+ 'beaconsDidRange',
103
+ (data) => {
104
+ // data.region - The current region
105
+ // data.region.identifier
106
+ // data.region.uuid
107
+
108
+ // data.beacons - Array of all beacons inside a region
109
+ // in the following structure:
110
+ // .uuid
111
+ // .major - The major version of a beacon
112
+ // .minor - The minor version of a beacon
113
+ // .rssi - Signal strength: RSSI value (between -100 and 0)
114
+ // .proximity - Proximity value, can either be "unknown", "far", "near" or "immediate"
115
+ // .accuracy - The accuracy of a beacon
116
+ }
117
+ );
118
+ ```
119
+
120
+ #### API
121
+
122
+ | Method | Description |
123
+ |:----------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
124
+ | **requestWhenInUseAuthorization** | This method should be called before anything else is called. It handles to request the use of beacons while the application is open. If the application is in the background, you will not get a signal from beacons. Either this method or `Beacons.requestAlwaysAuthorization` needs to be called to receive data from beacons. |
125
+ | **requestAlwaysAuthorization** | This method should be called before anything else is called. It handles to request the use of beacons while the application is open or in the background. Either this method or `Beacons.requestWhenInUseAuthorization` needs to be called to receive data from beacons. |
126
+ | **getAuthorizationStatus** | This methods gets the current authorization status. While this methods provides a callback, it is not executed asynchronously. The values `authorizedAlways` and `authorizedWhenInUse` correspond to the methods `requestWhenInUseAuthorization` and `requestAlwaysAuthorization` respectively. |
127
+ | **startMonitoringForRegion** | When starting monitoring for beacons, we need to define a region as the parameter. The `region` is an object, which needs to have at least two values: `identifier` and `uuid`. Additionally, it can also have a `major`, `minor` version or both. Make sure to not re-use the same identifier. In that case, we won't get the data for the beacons. The corresponding events are `regionDidEnter` and `regionDidExit`. |
128
+ | **stopMonitoringForRegion** | Stops monitoring for beacons. We pass a `region` as parameter, which has the same shape as the argument we pass in `startMonitoringForRegion`. |
129
+ | **startRangingBeaconsInRegion** | When ranging for beacons, we need to define a `region` as the parameter. The `region` is an object, which needs to have at least two values: `identifier` and `uuid`. Additionally, it can also have a `major`, `minor` version or both. Make sure to not re-use the same identifier. In that case, we won't get the data for the beacons. The corresponding events are `beaconsDidRange`. The event will fire in every interval the beacon sends a signal, which is one second in most cases. If we are monitoring and ranging for beacons, it is best to first call `startMonitoringForRegion` and then call `startRangingBeaconsInRegion`. |
130
+ | **stopRangingBeaconsInRegion** | Stops ranging for beacons. We pass a `region` as parameter, which has the same shape as the argument we pass in `startRangingBeaconsInRegion`. |
131
+ | **requestStateForRegion** | When requesting state for beacons, we need to define a `region` as the parameter. The `region` is an object, which needs to have at least two values: `identifier` and `uuid`. Additionally, it can also have a `major`, `minor` version or both. Make sure to not re-use the same identifier. In that case, we won't get the data for the beacons. The corresponding events are `didDetermineState`. |
132
+ | **startUpdatingLocation** | This call is needed for monitoring beacons and gets the initial position of the device. |
133
+ | **stopUpdatingLocation** | This method should be called when you don't need to receive location-based information and want to save battery power. |
134
+ | **shouldDropEmptyRanges** | Call this method to stop sending the `beaconsDidRange` event when the beacon list is empty. This can be useful when listening to multiple beacon regions and can reduce cpu usage by 1-1.5%. |
135
+
136
+ |
137
+ | Event | Description |
138
+ |:---------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
139
+ | **authorizationStatusDidChange** | This event will be called when authorization changed for receiving data location. PLEASE NOTE: starting a location service will not provide data location until authorization is given by the user ("authorizedAlways" or "authorizedWhenInUse"). |
140
+ | **beaconsDidRange** | This event will be called for every region in every beacon interval. If you have three regions you get three events every second (which is the default interval beacons send their signal). When we take a closer look at the parameter of the callback, we get information on both the region and the beacons. |
141
+ | **regionDidEnter** | If the device entered a region, `regionDidEnter` is being called. Inside the callback the parameter we can use returns an object with a property `region` that contains the `region` identifier value as a string. Additionally, we get the UUID of the region through its `uuid` property. |
142
+ | **regionDidExit** | In the same `regionDidEnter` is called if the device entered a region, `regionDidExit` will be called if the device exited a region and we can't get any signal from any of the beacons inside the region. As for the payload, we get a property called `region` that represents the `region` identifier and is a string as well as the `uuid`. |
143
+ | **didDetermineState** | If there is a boundary transition for a region, `didDetermineState` is being called. Inside the callback the parameter we can use returns an object with a property `region` that contains the `region` identifier value as a string. Additionally, we get the UUID of the region through its `uuid` property. |
144
+ | **authorizationDidChange** | When the user permissions change, for example the user allows to always use beacons, this event will be called. The same applies when the user revokes the permission to use beacons. The payload is a string which can either be: `"authorizedAlways"`, `"authorizedWhenInUse"`, `"denied"`, `"notDetermined"` or `"restricted"` |
145
+
146
+
147
+ ### 4.b Android
148
+
149
+ #### Simple example
150
+
151
+ ```javascript
152
+ import { DeviceEventEmitter } from 'react-native'
153
+ import Beacons from 'react-native-beacons-manager'
154
+
155
+ // Tells the library to detect iBeacons
156
+ Beacons.detectIBeacons()
157
+
158
+ // Start detecting all iBeacons in the nearby
159
+ try {
160
+ await Beacons.startRangingBeaconsInRegion('REGION1')
161
+ console.log(`Beacons ranging started succesfully!`)
162
+ } catch (err) {
163
+ console.log(`Beacons ranging not started, error: ${error}`)
164
+ }
165
+
166
+ // Print a log of the detected iBeacons (1 per second)
167
+ DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
168
+ console.log('Found beacons!', data.beacons)
169
+ })
170
+ ```
171
+
172
+ #### API
173
+
174
+ | Method | Description |
175
+ |:--------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
176
+ | **detectCustomBeaconLayout(parser: string): void** | Allows the detection of a custom beacon layout. For example `detectCustomBeaconLayout('m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24')` allows you to detect iBeacons beacons. |
177
+ | **detectIBeacons(): void** | Allows the detection of iBeacons. It's just like calling detectCustomBeaconLayout with the iBeacons layout. |
178
+ | **detectEstimotes(): void** | Allows the detection of Estimote beacons. It's just like calling `detectCustomBeaconLayout` with the Estimote layout. |
179
+ | **checkTransmissionSupported(): promise** | Checks if the device can use the Bluetooth to detect the beacons. |
180
+ | **setForegroundScanPeriod(period: number): void** | Sets the duration in milliseconds of each Bluetooth LE scan cycle to look for beacons (in foreground). For more info [take a look at the official docs](https://altbeacon.github.io/android-beacon-library/javadoc/index.html) |
181
+ | **setBackgroundScanPeriod(period: number): void** | Sets the duration in milliseconds of each Bluetooth LE scan cycle to look for beacons (in background). For more info [take a look at the official docs](https://altbeacon.github.io/android-beacon-library/javadoc/index.html) |
182
+ | **setBackgroundBetweenScanPeriod(period: number): void** | Sets the duration in milliseconds spent not scanning between each Bluetooth LE scan cycle when no ranging/monitoring clients are in the foreground. For more info [take a look at the official docs](https://altbeacon.github.io/android-beacon-library/javadoc/index.html) |
183
+ | **setRssiFilter(filterType: int, avgModifier: number): void** | Sets the RSSI averaging method. The parameter `filterType` must be one of the exported constants `ARMA_RSSI_FILTER` or `RUNNING_AVG_RSSI_FILTER`. The `avgModifier` param changes the rate of the averaging function For the ARMA filter it's in the range 0.1-1.0, for the running average it's the filter window in milliseconds. For more info [take a look at the docs](https://altbeacon.github.io/android-beacon-library/distance_vs_time.html) |
184
+ | **setHardwareEqualityEnforced(e: boolean): void** | Configures whether the bluetoothAddress (mac address) must be the same for two Beacons to be configured equal. This setting applies to all beacon instances in the same process. Defaults to false for backward compatibility. Useful when all the beacons you are working with have the same UUID, major and minor (they are only uniquely identifiable by their mac address), otherwise the module will detect all the beacons as if they were only one. For more info [take a look at the official docs](https://altbeacon.github.io/android-beacon-library/javadoc/index.html) |
185
+ | **getRangedRegions(): promise** | Returns a promise that resolves in an array with the regions being ranged. |
186
+ | **getMonitoredRegions(): promise** | Returns a promise that resolves in an array with the regions being monitored. |
187
+ | **startMonitoringForRegion({identifier: string, uuid: string, minor: int, major: int}): promise** | Starts monitoring for beacons. The parameter `identifier` must be an unique ID. The parameter `uuid` is optional, it allows you to detect only the beacons with a specific UUID (if `null` every beacon will be detected). The parameters `minor` and `major` are optional, they allow you to monitor only the region of a specific beacon. |
188
+ | **startRangingBeaconsInRegion(regionId: string, beaconsUUID: string): promise** | Starts range scan for beacons. The parameter `regionId` must be an unique ID. The parameter `beaconsUUID` is optional, it allows you to detect only the beacons with a specific UUID (if `null` every beacon will be detected). |
189
+ | **startRangingBeaconsInRegion({identifier: string, uuid: string}): promise** | Starts range scan for beacons. The parameter `identifier` must be an unique ID. The parameter `uuid` is optional, it allows you to detect only the beacons with a specific UUID (if `null` every beacon will be detected). Prefer the use of this method over `startRangingBeaconsInRegion(regionId: string, beaconsUUID: string)`, as this method signature more closely matches the signature for the equivalent iOS method. `PLEASE NOTE: ` to listen `EddyStone` beacons on iOS, you have to pass an identifier as: `EDDY_STONE_REGION_ID`, (example: `Beacons.startRangingBeaconsInRegion({identifier: 'EDDY_STONE_REGION_ID', ...restOptions})`). |
190
+ | **stopMonitoringForRegion({identifier: string, uuid: string, minor: int, major: int}): promise** | Stops the monitoring for beacons. |
191
+ | **stopRangingBeaconsInRegion(regionId: string, beaconsUUID: string): promise** | Stops the range scan for beacons. |
192
+ | **stopRangingBeaconsInRegion({identifier: string, uuid: string}): promise** | Stops the range scan for beacons. Prefer the use of this method over `stopRangingBeaconsInRegion(regionId: string, beaconsUUID: string)`, as this method signature more closely matches the signature for the equivalent iOS method. |
193
+ | **requestStateForRegion({identifier: string, uuid: string, minor: int, major: int}): void** | Retrieves the state of a region asynchronously. The parameter `identifier` must be an unique ID. The parameter `uuid` is optional, it allows you to detect only the beacons with a specific UUID (if `null` every beacon will be detected). The parameters `minor` and `major` are optional, they allow you to monitor only the region of a specific beacon. |
194
+
195
+
196
+ ## TODO:
197
+ **Standardization of iOS and android to make library more coherent:**
198
+
199
+ - **iOS**
200
+ - [x] `startRangingBeaconsInRegion` and `startMonitoringForRegion` should return promises like android
201
+
202
+ - **android**
203
+ - [x] `startRangingBeaconsInRegion` should accept an object like iOS and other methods (won't prevent from accepting current parameters: not to break existing)
204
+
205
+ **Improvements or new feature:**
206
+
207
+ - **iOS**
208
+ - [x] add support to Eddystone
209
+ - **android**
210
+ - [ ] add support to Eddystone
211
+
212
+
213
+ ## Donate
214
+
215
+ Do you use & like react-native-beacons-manager but you don’t find a way to show some love?
216
+ If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though 😄
217
+
218
+ [![Support via PayPal](./images/paypal/Paypal-button.png)](https://www.paypal.me/ErwanDatin/)
219
+
220
+
221
+ ## license
222
+
223
+ The MIT License (MIT)
224
+
225
+ Copyright (c) 2019 Erwan DATIN
226
+
227
+ Permission is hereby granted, free of charge, to any person obtaining a copy
228
+ of this software and associated documentation files (the "Software"), to deal
229
+ in the Software without restriction, including without limitation the rights
230
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
231
+ copies of the Software, and to permit persons to whom the Software is
232
+ furnished to do so, subject to the following conditions:
233
+
234
+ The above copyright notice and this permission notice shall be included in all
235
+ copies or substantial portions of the Software.
236
+
237
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
238
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
239
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
240
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
241
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
242
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
243
+ SOFTWARE.
244
+
245
+
246
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMacKentoch%2Freact-native-beacons-manager.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FMacKentoch%2Freact-native-beacons-manager?ref=badge_large)
@@ -0,0 +1,13 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "ReactNativeBeaconsManager"
3
+ s.version = "1.0.0"
4
+ s.summary = "React-Native library for detecting beacons (iOS and Android)"
5
+ s.homepage = "https://github.com/rodrigo-nexudus/react-native-beacons-manager#readme"
6
+ s.license = { :type => "MIT" }
7
+ s.authors = { "" => "" }
8
+ s.platform = :ios, "8.0"
9
+ s.source = { :path => "." }
10
+ s.source_files = "ios", "ios/**/*.{h,m}"
11
+
12
+ s.dependency 'React'
13
+ end
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>android</name>
4
+ <comment>Project android created by Buildship.</comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
+ </natures>
17
+ </projectDescription>
@@ -0,0 +1,2 @@
1
+ connection.project.dir=
2
+ eclipse.preferences.version=1
@@ -0,0 +1,108 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ jcenter()
5
+ }
6
+
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:3.5.3'
9
+ }
10
+ }
11
+
12
+ apply plugin: 'com.android.library'
13
+
14
+
15
+ def DEFAULT_COMPILE_SDK_VERSION = 28
16
+ def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
17
+ def DEFAULT_TARGET_SDK_VERSION = 23
18
+
19
+ android {
20
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
21
+ buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
22
+
23
+ defaultConfig {
24
+ minSdkVersion 16
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
26
+ versionCode 1
27
+ versionName "1.0"
28
+ }
29
+ }
30
+
31
+ repositories {
32
+ mavenCentral()
33
+ jcenter()
34
+ google()
35
+
36
+ def found = false
37
+ def defaultDir = null
38
+ def androidSourcesName = 'React Native sources'
39
+
40
+ if (rootProject.ext.has('reactNativeAndroidRoot')) {
41
+ defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
42
+ } else {
43
+ defaultDir = new File(
44
+ projectDir,
45
+ '/../../../node_modules/react-native/android'
46
+ )
47
+ }
48
+
49
+ if (defaultDir.exists()) {
50
+ maven {
51
+ url defaultDir.toString()
52
+ name androidSourcesName
53
+ }
54
+
55
+ logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
56
+ found = true
57
+ } else {
58
+ def parentDir = rootProject.projectDir
59
+
60
+ 1.upto(5, {
61
+ if (found) return true
62
+ parentDir = parentDir.parentFile
63
+
64
+ def androidSourcesDir = new File(
65
+ parentDir,
66
+ 'node_modules/react-native'
67
+ )
68
+
69
+ def androidPrebuiltBinaryDir = new File(
70
+ parentDir,
71
+ 'node_modules/react-native/android'
72
+ )
73
+
74
+ if (androidPrebuiltBinaryDir.exists()) {
75
+ maven {
76
+ url androidPrebuiltBinaryDir.toString()
77
+ name androidSourcesName
78
+ }
79
+
80
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
81
+ found = true
82
+ } else if (androidSourcesDir.exists()) {
83
+ maven {
84
+ url androidSourcesDir.toString()
85
+ name androidSourcesName
86
+ }
87
+
88
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
89
+ found = true
90
+ }
91
+ })
92
+ }
93
+
94
+ if (!found) {
95
+ throw new Exception(
96
+ "${project.name}: unable to locate React Native android sources. " +
97
+ "Ensure you have you installed React Native as a dependency in your project and try again."
98
+ )
99
+ }
100
+ }
101
+
102
+
103
+ dependencies {
104
+ //noinspection GradleDynamicVersion
105
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
106
+ implementation 'com.facebook.react:react-native:0.67.2'
107
+ implementation 'org.altbeacon:android-beacon-library:2.19.6'
108
+ }
@@ -0,0 +1,6 @@
1
+ #Thu Dec 19 22:37:23 CET 2019
2
+ distributionBase=GRADLE_USER_HOME
3
+ distributionPath=wrapper/dists
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
@@ -0,0 +1,2 @@
1
+ android.useAndroidX=true
2
+ android.enableJetifier=true