I'm currently testing Android companion device pairing and I'm not sure how to benefit from the REQUEST_COMPANION_RUN_IN_BACKGROUND permission.
In one part of Google documentation is says:
After the device is paired, the device can leverage the
REQUEST_COMPANION_RUN_IN_BACKGROUND and
REQUEST_COMPANION_USE_DATA_IN_BACKGROUND permissions to start the app
from the background. You might use this method of pairing devices for
initial configuration of a BLE-capable smart watch, for example.
in the permission itself:
Allows a companion app to run in the background.
and in the CompanionDeviceManager documentation it says:
If your app needs to be excluded from battery optimizations (run in
the background) or to have unrestricted data access (use data in the
background) you can declare that you use the
android.Manifest.permission#REQUEST_COMPANION_RUN_IN_BACKGROUND and
respectively.
Can someone please explain (or point me towards some sample code) how to leverage this permission in order to run the app in the background? Ideally I would like trigger an action in the companion app from the paired Bluetooth LE peripheral device.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…