New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-nearby

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-nearby

Uses Bluetooth LE to scan and advertise for nearby devices

  • 3.2.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@capacitor-community/capacitor-nearby

Uses Bluetooth LE to scan and advertise for nearby devices

Install

npm install @capacitor-community/capacitor-nearby
npx cap sync

API

initialize(...)

initialize(options: InitializeOptions) => Promise<void>

Initializes Bluetooth LE for advertising and scanning of nearby tokens.

ParamType
optionsInitializeOptions

Since: 1.0.0


reset()

reset() => Promise<void>

Stops and resets advertising and scanning of nearby tokens.

Since: 1.0.0


publish(...)

publish(options: PublishOptions) => Promise<void>

Start publishing nearby token.

ParamType
optionsPublishOptions

Since: 1.0.0


unpublish()

unpublish() => Promise<void>

Stop publishing nearby token.

Since: 1.0.0


subscribe(...)

subscribe(options: SubscribeOptions) => Promise<void>

Start listening to nearby tokens.

ParamType
optionsSubscribeOptions

Since: 1.0.0


unsubscribe()

unsubscribe() => Promise<void>

Stop listening to nearby tokens.

Since: 1.0.0


status()

status() => Promise<Status>

Returns status of operations and found tokens.

Returns: Promise<Status>

Since: 1.0.0


addListener('onPermissionChanged', ...)

addListener(eventName: 'onPermissionChanged', listenerFunc: (granted: boolean) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when permission is granted or revoked for this app to use Nearby.

ParamType
eventName'onPermissionChanged'
listenerFunc(granted: boolean) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('onBluetoothStateChanged', ...)

addListener(eventName: 'onBluetoothStateChanged', listenerFunc: (state: BluetoothState) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when state of Bluetooth has changed.

ParamType
eventName'onBluetoothStateChanged'
listenerFunc(state: BluetoothState) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('onFound', ...)

addListener(eventName: 'onFound', listenerFunc: BeaconCallback) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when beacons are found.

ParamType
eventName'onFound'
listenerFuncBeaconCallback

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.1.0


addListener('onLost', ...)

addListener(eventName: 'onLost', listenerFunc: BeaconCallback) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when a beacon is no longer detectable nearby.

ParamType
eventName'onLost'
listenerFuncBeaconCallback

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.1.0


addListener('onPublishExpired', ...)

addListener(eventName: 'onPublishExpired', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

The published token has expired.

ParamType
eventName'onPublishExpired'
listenerFunc() => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('onSubscribeExpired', ...)

addListener(eventName: 'onSubscribeExpired', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

The subscription has expired.

ParamType
eventName'onSubscribeExpired'
listenerFunc() => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


Interfaces

InitializeOptions
PropTypeDescriptionDefaultSince
serviceUUIDUUIDSets the service UUID for the nearby token.1.0.0
scanModeScanModeSets the scan mode. Default: Perform Bluetooth LE scan in balanced power mode.ScanMode.BALANCED1.0.0
advertiseModeAdvertiseModeSets the advertise mode. Default: Perform Bluetooth LE advertising in low latency, high power mode.AdvertiseMode.LOW_LATENCY1.0.0
txPowerLevelTxPowerLevelSets the TX power level for advertising. Default: Advertise using high TX power level.TxPowerLevel.HIGH1.0.0
PublishOptions
PropTypeDescriptionSince
uuidUUIDSets the beacon UUID for the publish operation.1.1.0
ttlSecondsTTLSecondsSets the time to live in seconds for the publish operation.1.0.0
SubscribeOptions
PropTypeDescriptionSince
ttlSecondsTTLSecondsSets the time to live in seconds for the subscribe operation.1.0.0
PluginListenerHandle
PropType
remove() => Promise<void>

Type Aliases

UUID

string

Status

{ isPublishing: boolean; isSubscribing: boolean; uuids: UUID[]; }

BeaconCallback

(uuid: string, rssi?: string | number): void

Enums

ScanMode
MembersValue
LOW_POWER0
BALANCED1
LOW_LATENCY2
OPPORTUNISTIC-1
AdvertiseMode
MembersValue
LOW_POWER0
BALANCED1
LOW_LATENCY2
TxPowerLevel
MembersValue
ULTRA_LOW0
LOW1
MEDIUM2
HIGH3
TTLSeconds
MembersValue
TTL_SECONDS_DEFAULT300
TTL_SECONDS_MAX86400
TTL_SECONDS_INFINITE2147483647
BluetoothState
MembersValue
UNKNOWN'unknown'
RESETTING'resetting'
UNSUPPORTED'unsupported'
UNAUTHORIZED'unauthorized'
POWERED_OFF'poweredOff'
POWERED_ON'poweredOn'

Keywords

FAQs

Package last updated on 11 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc