Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Unhandled exception if no internet access is active #28

Open
uprtdev opened this issue Nov 15, 2018 · 0 comments
Open

Unhandled exception if no internet access is active #28

uprtdev opened this issue Nov 15, 2018 · 0 comments

Comments

@uprtdev
Copy link

uprtdev commented Nov 15, 2018

This issue is happens in the same situation like in the similar issue in cordova-plugin-chrome-apps-sockets-tcp:
MobileChromeApps/cordova-plugin-chrome-apps-sockets-tcp#31

On Android 7 (tested on Geotel A1) in case there is no internet connection on the device, app crashes because of the unhandled exception "java.nio.channels.UnresolvedAddressException".

For me it was solved by adding a corresponding exception handler to the void dequeueSend() method, like:

  void dequeueSend() {
...
    UdpSendPacket sendPacket = null;
    try {
...
    } catch (InterruptedException e) {
    } catch (IOException e) {
      sendPacket.callbackContext.error(buildErrorInfo(-2, e.getMessage()));
    } catch (java.nio.channels.UnresolvedAddressException e) {
      sendPacket.callbackContext.error(buildErrorInfo(-2, "Failed to resolve address"));
    }
  }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant