Listening for Cradle lock/unlock events

// Expert user has replied.
E Erik Hellman 3 years 7 months ago
76 2 0

Hi,
 
Is there any way to listen for the true state of the lock of the cradle or even query the cradle about it's current locked/unlocked state? I haven't been able to do either so far.
 
Also, how would I go about to detect being placed in the cradle but not yet picked up?
 
We basically have three states in our app. Parked and locked, Parked but not locked (reserved for user) and not parked (picked up by user).
 
Listening for battery state changes have proved unreliable and I'm not able to detect the state of the lock.
 
Please advice.
 
Cheers,
Erik

Please Register or Login to post a reply

2 Replies

J Jacques Gourmelen

Erik,

As far as I know, no event is triggered as the unit is docked / un-docked / locked / unlocked.

My understanding goes as follows:

when sled into a cradle slot, the MC18 unit is automatically locked.
to programmatically unlock it, the unlock method needs to be called and passed a unlockDuration argument expressed in seconds, which must range from 10 (minimum) to 30 (maximum) seconds.

If the device is already unlocked, the unlock method returns ALREADY_UNLOCKED

--

& If have successfully and reliably used a BroadcastReceiver to

get notified as ACTION_POWER_CONNECTED​ and ACTION_POWER_DISCONNECTED events are raised and
determine whether or not the unit sits in a cradle (E.g. by calling the getCradleInfo method, shortly after receiving a ACTION_POWER_CONNECTED​ event)

Kind regards,
Jacques

J Jacques Gourmelen

Good morning Erik,

Can you please let us know which devices you are using / targeting?

Are you stating the below approach is not reliable?
Monitoring the Battery Level and Charging State | Android Developers

Kind regards,
Jacques

CONTACT
Can’t find what you’re looking for?