Skip to content

Commit

Permalink
changes for target sdk 34
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanth committed Oct 25, 2024
1 parent 84813f4 commit 7619ecd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"></uses-permission>
<!-- Allows access to bluetooth tethering state -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
Expand Down Expand Up @@ -195,8 +196,14 @@

<service
android:name=".service.FirewallService"
android:foregroundServiceType="specialUse"
android:exported="true"
android:launchMode="singleTop" />
android:launchMode="singleTop" >

<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Firewall service"/>

</service>

<service
android:name=".service.ToggleTileService"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.ukanth.ufirewall.service;

import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
Expand Down Expand Up @@ -150,7 +152,9 @@ private void addNotification() {
.build();

//if(G.activeNotification()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(NOTIFICATION_ID, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
} else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
startForeground(NOTIFICATION_ID, notification);
} else {
manager.notify(NOTIFICATION_ID, notification);
Expand Down

0 comments on commit 7619ecd

Please sign in to comment.