As stated here:
https://developer.linkedin.com/support/developer-program-transition
the access for connections have been removed from the public API. You can only get access if you apply to a Partner Program which requires an official review of your app.
The example code you posted for Android doesn't actually use the public API to get the connections, it uses the API to get an access token and then uses the following URL to get the connections in CSV format and shows it in a WebView
:
https://www.linkedin.com/people/export-settings?exportNetwork=Export&outputType=microsoft_outlook
If you don't want to use a WebView
, you could possible download the CSV output, and parse it to get the actual data.
To parse the CSV you can use a CSV library like the following:
https://github.com/davedelong/CHCSVParser