
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@capacitor-trancee/nearby
Advanced tools
Uses Bluetooth LE to scan and advertise for nearby devices
Uses Bluetooth LE to scan and advertise for nearby devices
npm install @capacitor-trancee/nearby
npx cap sync
initialize(...)
reset()
publish(...)
unpublish()
subscribe(...)
unsubscribe()
status()
addListener('onPermissionChanged', ...)
addListener('onBluetoothStateChanged', ...)
addListener('onFound', ...)
addListener('onLost', ...)
addListener('onPublishExpired', ...)
addListener('onSubscribeExpired', ...)
initialize(options: InitializeOptions) => Promise<void>
Initializes Bluetooth LE for advertising and scanning of nearby tokens.
Param | Type |
---|---|
options | InitializeOptions |
Since: 1.0.0
reset() => Promise<void>
Stops and resets advertising and scanning of nearby tokens.
Since: 1.0.0
publish(options: PublishOptions) => Promise<void>
Start publishing nearby token.
Param | Type |
---|---|
options | PublishOptions |
Since: 1.0.0
unpublish() => Promise<void>
Stop publishing nearby token.
Since: 1.0.0
subscribe(options: SubscribeOptions) => Promise<void>
Start listening to nearby tokens.
Param | Type |
---|---|
options | SubscribeOptions |
Since: 1.0.0
unsubscribe() => Promise<void>
Stop listening to nearby tokens.
Since: 1.0.0
status() => Promise<Status>
Returns status of operations and found tokens.
Returns: Promise<Status>
Since: 1.0.0
addListener(eventName: 'onPermissionChanged', listenerFunc: (granted: boolean) => void) => Promise<PluginListenerHandle>
Called when permission is granted or revoked for this app to use Nearby.
Param | Type |
---|---|
eventName | 'onPermissionChanged' |
listenerFunc | (granted: boolean) => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onBluetoothStateChanged', listenerFunc: (state: BluetoothState) => void) => Promise<PluginListenerHandle>
Called when state of Bluetooth has changed.
Param | Type |
---|---|
eventName | 'onBluetoothStateChanged' |
listenerFunc | (state: BluetoothState) => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onFound', listenerFunc: BeaconCallback) => Promise<PluginListenerHandle>
Called when beacons are found.
Param | Type |
---|---|
eventName | 'onFound' |
listenerFunc | BeaconCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.1.0
addListener(eventName: 'onLost', listenerFunc: BeaconCallback) => Promise<PluginListenerHandle>
Called when a beacon is no longer detectable nearby.
Param | Type |
---|---|
eventName | 'onLost' |
listenerFunc | BeaconCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.1.0
addListener(eventName: 'onPublishExpired', listenerFunc: () => void) => Promise<PluginListenerHandle>
The published token has expired.
Param | Type |
---|---|
eventName | 'onPublishExpired' |
listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onSubscribeExpired', listenerFunc: () => void) => Promise<PluginListenerHandle>
The subscription has expired.
Param | Type |
---|---|
eventName | 'onSubscribeExpired' |
listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
Prop | Type | Description | Default | Since |
---|---|---|---|---|
serviceUUID | UUID | Sets the service UUID for the nearby token. | 1.0.0 | |
scanMode | ScanMode | Sets the scan mode. Default: Perform Bluetooth LE scan in balanced power mode. | ScanMode.BALANCED | 1.0.0 |
advertiseMode | AdvertiseMode | Sets the advertise mode. Default: Perform Bluetooth LE advertising in low latency, high power mode. | AdvertiseMode.LOW_LATENCY | 1.0.0 |
txPowerLevel | TxPowerLevel | Sets the TX power level for advertising. Default: Advertise using high TX power level. | TxPowerLevel.HIGH | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
uuid | UUID | Sets the beacon UUID for the publish operation. | 1.1.0 |
ttlSeconds | TTLSeconds | Sets the time to live in seconds for the publish operation. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
ttlSeconds | TTLSeconds | Sets the time to live in seconds for the subscribe operation. | 1.0.0 |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type |
---|---|
uuid | UUID |
rssi | string | number |
string
{ isPublishing: boolean; isSubscribing: boolean; uuids: UUID[]; }
(_: Beacon): void
Members | Value |
---|---|
LOW_POWER | 0 |
BALANCED | 1 |
LOW_LATENCY | 2 |
OPPORTUNISTIC | -1 |
Members | Value |
---|---|
LOW_POWER | 0 |
BALANCED | 1 |
LOW_LATENCY | 2 |
Members | Value |
---|---|
ULTRA_LOW | 0 |
LOW | 1 |
MEDIUM | 2 |
HIGH | 3 |
Members | Value |
---|---|
TTL_SECONDS_DEFAULT | 300 |
TTL_SECONDS_MAX | 86400 |
TTL_SECONDS_INFINITE | 2147483647 |
Members | Value |
---|---|
UNKNOWN | 'unknown' |
RESETTING | 'resetting' |
UNSUPPORTED | 'unsupported' |
UNAUTHORIZED | 'unauthorized' |
POWERED_OFF | 'poweredOff' |
POWERED_ON | 'poweredOn' |
FAQs
Uses Bluetooth LE to scan and advertise for nearby devices
The npm package @capacitor-trancee/nearby receives a total of 2 weekly downloads. As such, @capacitor-trancee/nearby popularity was classified as not popular.
We found that @capacitor-trancee/nearby demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.