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, ....;
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.