npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

background-beacon-monitoring

v0.0.3

Published

Proximity Beacon background monitoring for android (supporting iBeacons)

Downloads

4

Readme

Background Beacon Monitoring

Cordova plugin allowing background beacon monitoring and ranging on Android. Uses the altbeacon library for providing the API to interact with beacons.

The altbeacon library jar is provided in libs/android directory.

Installation

Installing the plugin is as simple as adding the plugin to cordova using the plugin add command.

cordova plugin add https://github.com/nirina-apiqa/background-beacon-monitoring.git

To install the plugin when using the Ionic framework the following command will add the plugin and save it to package.json.

ionic plugin add https://github.com/nirina-apiqa/background-beacon-monitoring.git

Currently the altbeacon jar file is not linked when the plugin is installed due to a clash if the cordova-plugin-ibeacon is installed as this also uses the altbeacon library for Android (currently working on fixing this). If this is only being used then uncomment the following line in plugin.xml, fix for this is being worked on.

<!-- <source-file src="libs/android/altbeacon.jar" target-dir="libs" framework="true" /> -->

Usage

Once the plugin is added it is available for use as BackgroundBeaconMonitoring

In order to access the location information and details of the beacons detected the plugin requires either of ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION. The app requests both of these permissions from the user through the BackgroundBeaconMonitoring.requestPermissions() method.

After the user has given permission to access their location information the service can be started using the BackgroundBeaconMonitoring.startService() method.

API Reference

requestPermissions()

BackgroundBeaconMonitoring.requestPermissions(successCallback, errorCallback)

Requests the permissions needed to access the users location and therefore the beacon information. The success and error callbacks are optional.

| Parameter | Description | | --- | --- | | successCallback | [Optional] Callback function to run when the method returns successfully | | errorCallback | [Optional] Callback function to run when the method returns an error, the function can accept a parameter to hold the message returned from the native layer so any errors encountered eg. 'PERMISSION DENIED' can be dealt with in the calling application appropriately |

startService()

BackgroundBeaconMonitoring.startService(device_id, monitoring_api_url, ranging_api_url, sendMovementData, successCallback, errorCallback)

Starts the background service and sets the location and access details for the API.

| Parameter | Description | | --- | --- | | device_id | The device id of the user mobile device. For consistency with requests sent within the app this is generated using $cordovaDevice.getUUID() in ionic/cordova | | monitoring_api_url | The URL fetched after background entering or exiting region event` | | ranging_api_url | The URL fetched after background ranging event | | sendMovementData | Whether to actually send the interactions with the beacons or not | | successCallback | Callback function to run when the method returns successfully | | errorCallback | Callback function to run when the method returns an error |

startMonitoringRegion()

BackgroundBeaconMonitoring.startMonitoringRegion(identifier, uuid, major, minor, successCallback, errorCallback)

Starts monitoring the region specified by the uuid, major and minor and labels it with the unique identifier.

| Parameter | Description | | --- | --- | | identifier | The unique identifier/name of the region to start monitoring | | uuid | The uuid of the region to monitor | | major | The major id number of the region to monitor - can be null so monitors all beacons for the uuid | | minor | The minor id number of the region to monitor - can be null and will scan for all beacons with uuid and major if major is specified, If major is null then this value is ignored | | successCallback | Callback function to run when the method returns successfully | | errorCallback | callback function to run when the method returns an error |

stopMonitoringRegion()

BackgroundBeaconMonitoring.stopMonitoringRegion(identifier, successCallback, errorCallback)

Stop monitoring the region specified by identifier, this is the same unique identifier used in the startMonitoringRegion() method.

| Parameter | Description | | --- | --- | | identifier | The unique identifier/name of the region to stop monitoring, this is the same one as used to start monitoring | | successCallback | Callback function to run when the method returns successfully | | errorCallback | Callback function to run when the method returns an error |

startRangingRegion()

BackgroundBeaconMonitoring.startRangingRegion(identifier, uuid, major, minor, successCallback, errorCallback)

Starts ranging the region specified by the uuid, major and minor and labels it with the unique identifier. The unique identifier can be the same as one used with associated uuid/major/minor in startMonitoringRegion() to range the region as well.

| Parameter | Description | | --- | --- | | identifier | The unique identifier/name of the region to start ranging | | uuid | The uuid of the region to range | | major | The major id number of the region to range - can be null so monitors all beacons for the uuid | | minor | The minor id number of the region to range - can be null and will scan for all beacons with uuid and major if major is specified, If major is null then this value is ignored | | successCallback | Callback function to run when the method returns successfully | | errorCallback | callback function to run when the method returns an error |

stopRangingRegion()

BackgroundBeaconMonitoring.stopRangingRegion(identifier, successCallback, errorCallback)

Stop ranging the region specified by identifier, this is the same unique identifier used in the startRangingRegion() method.

| Parameter | Description | | --- | --- | | identifier | The unique identifier/name of the region to stop ranging, this is the same one as used to start monitoring | | successCallback | Callback function to run when the method returns successfully | | errorCallback | Callback function to run when the method returns an error |

setMovementPreference()

BackgroundBeaconMonitoring.setMovementPreference(preference, successCallback, errorCallback)

Changes the movement preference which controls whether the service sends interactions with the beacons, allows the user of the application to control the privacy of their movements.

| Parameter | Description | | --- | --- | | preference | True/False Boolean Parameter to change whether the service sends to the API | | successCallback | Callback function to run when the method returns successfully | | errorCallback | Callback function to run when the method returns an error |

Contributors

Contributions welcome by pull request.

License

Apache License v2.0