I have an app which uses a VpnService successfully, but I would like the app to start immediately after a device restarts, and start the vpn service again.
I have tried creating a BroadcastReciever for ACTION_BOOT_COMPLETED and restarting my app and vpn after the device restarts, but the data I am receiving from the vpn builder's file_descriptor file_input_stream is an ICMP message with error code 03 (Destination Port Unreachable).
This behavior only happens if I use the BroadcastReceiver to start my activity which starts my VPN Service. If I wait until the device has restarted and manually open my app, the vpn starts again with no problems with the file_input_stream.
Does anyone know of any flag that needs to be set when a device reboots before the vpn is ready to be used? It appears the streams are unavailable or otherwise in use at the time I'm trying to set my vpn up on device restart.