Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Private Network Key - Android Studio

Rank

Total Posts: 3

Joined 2020-06-21

PM

I am trying to use the AquireChannels sample app that came with the sdk to learn and to connect to a Garmin LidarLitev4. The LidarLitev4 uses the garmin developer private network key with which I am able to connect to the Lidar using the Antware II program. I am using Android Studio and I am a novice at java programming.
When I try to pass the network key to the AquireChannelOnPrivateNetwork method I am getting a Unhandled exception: com.dsi.ant.channel.UnsupportedFeatureException
Any ideas on what I am doing wrong?

Here is my code.
private NetworkKey mNetworkKey = new NetworkKey(new byte[]{(byte)0xB3, (byte)0xA2, (byte)0x13, (byte)0x43, (byte)0x7D, (byte)0x22, (byte)0xD1, (byte)0x11});

mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, mNetworkKey); <---get unhandled exception

Thanks in advance.      
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Where did you find that network key?

The issue is most likely because the key you used is different from the official Garmin Developer Network key, which can be found here:
https://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys      
Rank

Total Posts: 3

Joined 2020-06-21

PM

Thanks for the reply. You are correct that what I posted was not the Garmin developer key, I was messing around trying different things and had the wrong key in there when I posted. I replaced the key with the correct Garmin developer key and I still have the same issue. I am attaching the java file and screenshot of what I am getting.      

Image Attachments

ChannelProvider-UnhandledException.jpg

Click thumbnail to see full-size image

File Attachments

Rank

Total Posts: 3

Joined 2020-06-21

PM

I'm not sure how I missed this before , but I just went back and re-read the "Creating ANT Android Applications..." manual that comes with the SDK.
I found this:
3.3.3.2 Private Networks
This functionality is not currently available in the Android ANT API.

So I wonder if it is possible to program the Garmin LIDARLITE v4 to use a public key..
Thanks
     
Rank

Total Posts: 4

Joined 2020-11-23

PM

Android loves to swear at unlicensed programs. I recently downloaded an educational book https://freebooksummary.com/the-yellow-wallpaper-setting-13825 in PDF format and my Operating System went crazy. PDF Reader is a standard Google Play program that does not have third-party scripts. I had to use the root settings to open read access to the file.      
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

Which version of the ANT Radio Service do you currently have installed?

The UnsupportedFeatureException is thrown when the ARS version doesn't support the feature being called from the library, in this case the acquireChannelOnPrivateNetwork method. You require at least version 4.4 or higher.      
Rank

Total Posts: 1

Joined 2021-02-22

PM

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
     
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

Removed private network key from above post.

Believe you are in touch with info at thisisant.com. Will continue there.      

Signature

Ian Haigh

Rank

Total Posts: 2

Joined 2022-03-25

PM

That network key can be a wrong one?      
Rank

Total Posts: 3

Joined 2024-05-22

PM

I also want to know it.      
Rank

Total Posts: 3

Joined 2024-08-29

PM

paw1682 - 30 August 2020 09:03 PM
I am trying to use the AquireChannels sample app that came with the sdk to learn and to connect to a Garmin LidarLitev4. The LidarLitev4 uses the garmin developer private network key with which I am able to connect to the Lidar using the Antware II program. I am using Android Studio and I am a novice at java programming.
When I try to pass the network key to the AquireChannelOnPrivateNetwork method I am getting a Unhandled exception: com.dsi.ant.channel.UnsupportedFeatureException
Any ideas on what I am doing wrong?

Here is my code.
private NetworkKey mNetworkKey = new NetworkKey(new byte[]{(byte)0xB3, (byte)0xA2, (byte)0x13, (byte)0x43, (byte)0x7D, (byte)0x22, (byte)0xD1, (byte)0x11});

mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, mNetworkKey); <---get unhandled exception

Thanks in advance.


It seems you're facing the UnsupportedFeatureException while trying to use the acquireChannelOnPrivateNetwork method with your Garmin LidarLite v4. First, ensure the SDK you're using supports this method and that the network key format is correct. Wrap your code in a try-catch block to handle the exception and provide better insights. Additionally, if you're testing locally (127.0.0.1:62893), make sure there are no conflicts or blocked ports in your local environment. If the issue persists, checking the Garmin ANT SDK documentation might help.

Hope this helps!