mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 06:39:54 -04:00
Feat[launcher]: update to SDK 34
This commit is contained in:
parent
1dd0ba572d
commit
4668d9c9a2
@ -90,7 +90,7 @@ configurations {
|
||||
android {
|
||||
namespace 'net.kdt.pojavlaunch'
|
||||
|
||||
compileSdk = 33
|
||||
compileSdk = 34
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
@ -114,7 +114,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "net.kdt.pojavlaunch"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
targetSdkVersion 34
|
||||
versionCode getDateSeconds()
|
||||
versionName getVersionName()
|
||||
multiDexEnabled true //important
|
||||
|
@ -18,6 +18,8 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
|
||||
|
||||
<application
|
||||
android:name=".PojavApplication"
|
||||
@ -119,10 +121,12 @@
|
||||
</intent-filter>
|
||||
</provider>
|
||||
|
||||
<service android:name=".services.ProgressService" />
|
||||
<service android:name=".services.ProgressService"
|
||||
android:foregroundServiceType="dataSync"/>
|
||||
<service
|
||||
android:name=".services.GameService"
|
||||
android:process=":game" />
|
||||
android:process=":game"
|
||||
android:foregroundServiceType="mediaPlayback"/>
|
||||
</application>
|
||||
<queries>
|
||||
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
|
||||
|
@ -1,8 +1,10 @@
|
||||
package net.kdt.pojavlaunch.services;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
@ -43,7 +45,13 @@ public class GameService extends Service {
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notification_terminate), pendingKillIntent)
|
||||
.setSmallIcon(R.drawable.notif_icon)
|
||||
.setNotificationSilent();
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notificationBuilder.build());
|
||||
|
||||
Notification notification = notificationBuilder.build();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
|
||||
} else {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification);
|
||||
}
|
||||
return START_NOT_STICKY; // non-sticky so android wont try restarting the game after the user uses the "Quit" button
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package net.kdt.pojavlaunch.services;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.Process;
|
||||
@ -64,7 +66,12 @@ public class ProgressService extends Service implements TaskCountListener {
|
||||
}
|
||||
Log.d("ProgressService", "Started!");
|
||||
mNotificationBuilder.setContentText(getString(R.string.progresslayout_tasks_in_progress, ProgressKeeper.getTaskCount()));
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, mNotificationBuilder.build());
|
||||
Notification notification = mNotificationBuilder.build();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
|
||||
} else {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification);
|
||||
}
|
||||
if(ProgressKeeper.getTaskCount() < 1) stopSelf();
|
||||
else ProgressKeeper.addTaskCountListener(this, false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user