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