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

Get MissingForegroundServiceTypeException when connecting a vpn service #107

Open
Leyfear opened this issue Jun 22, 2024 · 4 comments
Open

Comments

@Leyfear
Copy link

Leyfear commented Jun 22, 2024

Still same error for Android 14+ after fix PR.

Error when show notification
E/de.blinkt.openvpn.core.OpenVPNService( 9598): android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{45c0324 9598:com.example.flutter_application_1/u0a425} targetSDK=34

@nizwar
Copy link
Owner

nizwar commented Jun 24, 2024

Can you try to add this on AndroidManifest.xml

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" android:minSdkVersion="34" />

let me know the result after

@willieee802
Copy link

Can you try to add this on AndroidManifest.xml

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" android:minSdkVersion="34" />

let me know the result after

I just tried that and the error still pops.

The changes I made while using this package are:

  • add this uses-permission in android/src/main/AndroidManifest.xml
  • override the onActivityResult in android/app/src/main/kotlin/xxxmypackagespath/MainActivity.kt as shown in the documentation

Not sure of anything missed or put in wrong place, the app pops permissions request correctly, vpn connects just fine, but keeps poping that forground service error.

@ighostnb
Copy link

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" android:minSdkVersion="34" />

<application
    android:icon="@mipmap/ic_launcher">

    <service
        android:name="de.blinkt.openvpn.core.OpenVPNService"
        android:foregroundServiceType="systemExempted"
        android:exported="false"
        tools:replace="android:exported" />
</application>

change it in package manifest

@willieee802
Copy link

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" android:minSdkVersion="34" />

<application
    android:icon="@mipmap/ic_launcher">

    <service
        android:name="de.blinkt.openvpn.core.OpenVPNService"
        android:foregroundServiceType="systemExempted"
        android:exported="false"
        tools:replace="android:exported" />
</application>

change it in package manifest

Problem solved

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

No branches or pull requests

4 participants