Hi,
I am on the same way. I am trying to receive measurements from a digital caliper but I can not pass the network key to acquireChannelOnPrivateNetwork method, because it accepts 16 byte network key. My key is only 8 byte.
Modified parts of ChannelService.java:
// Network key declaration
private static final byte[] NETWORK_KEY = new byte[]
{(byte) .....}; // Network Key
private NetworkKey mNetworkKey = new NetworkKey(NETWORK_KEY);
...
// Try to acquire a private channel with 8 byte Network key
try {
mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, mNetworkKey);
} catch (RemoteException e) {
die("ACP Remote Ex");
}
catch ( UnsupportedFeatureException e) {
Toast.makeText(this, "Unsupported Feature", Toast.LENGTH_SHORT).show();
die("ACP Unsupported Feature Ex");
}
catch ( IllegalArgumentException e) {
Toast.makeText(this, "ACP Illegal Argument Ex" + e, Toast.LENGTH_SHORT).show();
die("ACP Illegal Argument Ex" + e.toString());
}
I get "IllegalArgumentException: Received network key that is null or has invalid length" when I pass 8 byte Network key.
How can I pass the 8 byte key?
Regards,
Szabolcs