Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ANT+ Network key for Android device. 128bits. 

Rank

Total Posts: 1

Joined 2020-09-14

PM

Hi everyone, i have some problem about Network key using.

In my android project, i would like to usb background scan mode to scan all my ANT+ devices.

My code is below:
byte[] bytes = new byte[]{(byte)0xB9, (byte)0xA5, (byte)0x21, (byte)0xFB, (byte)0xBD, (byte)0x72, (byte)0xC3, (byte)0x45};
NetworkKey antPlusNetworkKey = new NetworkKey(bytes);

Capabilities capableOfBackgroundScan = new Capabilities();
capableOfBackgroundScan.supportBackgroundScanning(true);

Log.d(TAG, antPlusNetworkKey.toString());
try {
mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, antPlusNetworkKey, capableOfBackgroundScan);
} catch (UnsupportedFeatureException|IllegalArgumentException e) {
e.printStackTrace();
}
But i compiler my code, it cause an exception: java.lang.IllegalArgumentException: Received network key that is null or has invalid length

I use the correct network key, but the result shows it length error.

Can you tell my how can i solve this problems?

I find someone says "android need use 128bit network key", and how can i get it?

Many thanks.      
Rank

Total Posts: 1

Joined 2020-09-28

PM

Hi!

I have exactly the same problem, any solution?

Regards.