Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Added foregroundServiceType to OpenVPNService to resolve MissingForegroundServiceTypeException #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ahmed-faroukk
Copy link

@ahmed-faroukk ahmed-faroukk commented Oct 10, 2024

ForegroundServiceTypeException in Android 14

This PR addresses the MissingForegroundServiceTypeException error that occurs when running the OpenVPNService in the background on Android SDK 29 and above. The fix involves adding the required **foregroundServiceType** in the AndroidManifest.xml and specifying the service type when calling startForeground(). Tested and verified on target SDK 34.

Copy link
Author

@ahmed-faroukk ahmed-faroukk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: Added foregroundServiceType to OpenVPNService to resolve MissingForegroundServiceTypeException

@ahmed-faroukk
Copy link
Author

Fix: Added foregroundServiceType to OpenVPNService to resolve MissingForegroundServiceTypeException

@cihan53
Copy link

cihan53 commented Dec 3, 2024

it was solved when I gave the following permissions, I may have given a little too much permission

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BIND_VPN_SERVICE" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants