# Package com.codename1.nearby.companion

package com.codename1.nearby.companion

Companion-device association: telling the operating system which accessory is yours, and getting privileges back for it.

Start at `CompanionDevices`, which explains what association buys that an ordinary Bluetooth scan does not -- OS-run presence watching, scanning without location permission, and one honest consent prompt naming one device.

An association is a durable relationship: it survives app restarts and reboots, and ends only when the app drops it, the user revokes it in system settings, or the app is uninstalled. Persist `CompanionDevice.getId()` and look the device up again on the next launch instead of asking the user to pick it twice.

- Related Packages
  Package
  Description
  com.codename1.nearby
  Nearby devices: how far away one is, which one is yours, and how to send it something.
  com.codename1.nearby.ranging
  Ultra-wideband precision ranging: how far away another device is, and in which direction.
  com.codename1.nearby.spi
  The service-provider interface each port implements to carry `com.codename1.nearby` onto the platform's short-range stacks.
  com.codename1.nearby.transport
  Sending bytes and files to a device in the same room, with no access point, no pairing and no internet.
- Class
  Description
  AssociationRequest
  What to show the user in the system device chooser, built with `AssociationRequest.Builder`.
  AssociationRequest.Builder
  Assembles an `AssociationRequest`.
  CompanionDevice
  A device this app is associated with.
  CompanionDevices
  Companion-device association: the OS-managed relationship between this app and one particular accessory.
  CompanionProfile
  What kind of thing is being associated.
  DeviceFilter
  Narrows what the system device chooser offers the user.
  PresenceListener
  Told when an associated device comes into or goes out of range.