Loading app/src/main/AndroidManifest.xml +4 −1 Original line number Diff line number Diff line Loading @@ -579,6 +579,9 @@ android:foregroundServiceType="dataSync" android:exported="false" /> <service android:name="androidx.work.impl.foreground.SystemForegroundService" android:foregroundServiceType="dataSync" tools:node="merge" /> </application> </manifest> No newline at end of file app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java +12 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; import android.os.Bundle; Loading Loading @@ -493,8 +494,13 @@ public class ComposeWorker extends Worker { .setOngoing(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -515,9 +521,12 @@ public class ComposeWorker extends Worker { .setSilent(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_HIGH); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build()); } } @RequiresApi(Build.VERSION_CODES.O) private void createChannel() { Loading app/src/main/java/app/fedilab/android/mastodon/jobs/FetchHomeWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -103,8 +104,13 @@ public class FetchHomeWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.fetch_notifications)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -126,8 +132,13 @@ public class FetchHomeWorker extends Worker { .setDefaults(NotificationCompat.DEFAULT_ALL) .setSilent(true) .setPriority(Notification.PRIORITY_LOW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build()); } } @NonNull @Override Loading app/src/main/java/app/fedilab/android/mastodon/jobs/NotificationsWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -74,8 +75,13 @@ public class NotificationsWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.fetch_notifications)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -97,8 +103,13 @@ public class NotificationsWorker extends Worker { .setDefaults(NotificationCompat.DEFAULT_ALL) .setSilent(true) .setPriority(Notification.PRIORITY_LOW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build()); } } @NonNull @Override Loading app/src/main/java/app/fedilab/android/mastodon/jobs/ScheduleBoostWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -77,8 +78,13 @@ public class ScheduleBoostWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.schedule_boost)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -97,8 +103,13 @@ public class ScheduleBoostWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.schedule_boost)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build()); } } private OkHttpClient getOkHttpClient() { Loading Loading
app/src/main/AndroidManifest.xml +4 −1 Original line number Diff line number Diff line Loading @@ -579,6 +579,9 @@ android:foregroundServiceType="dataSync" android:exported="false" /> <service android:name="androidx.work.impl.foreground.SystemForegroundService" android:foregroundServiceType="dataSync" tools:node="merge" /> </application> </manifest> No newline at end of file
app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java +12 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; import android.os.Bundle; Loading Loading @@ -493,8 +494,13 @@ public class ComposeWorker extends Worker { .setOngoing(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -515,9 +521,12 @@ public class ComposeWorker extends Worker { .setSilent(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_HIGH); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build()); } } @RequiresApi(Build.VERSION_CODES.O) private void createChannel() { Loading
app/src/main/java/app/fedilab/android/mastodon/jobs/FetchHomeWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -103,8 +104,13 @@ public class FetchHomeWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.fetch_notifications)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -126,8 +132,13 @@ public class FetchHomeWorker extends Worker { .setDefaults(NotificationCompat.DEFAULT_ALL) .setSilent(true) .setPriority(Notification.PRIORITY_LOW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(FETCH_HOME_CHANNEL_ID, notificationBuilder.build()); } } @NonNull @Override Loading
app/src/main/java/app/fedilab/android/mastodon/jobs/NotificationsWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -74,8 +75,13 @@ public class NotificationsWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.fetch_notifications)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -97,8 +103,13 @@ public class NotificationsWorker extends Worker { .setDefaults(NotificationCompat.DEFAULT_ALL) .setSilent(true) .setPriority(Notification.PRIORITY_LOW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build()); } } @NonNull @Override Loading
app/src/main/java/app/fedilab/android/mastodon/jobs/ScheduleBoostWorker.java +13 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; import android.os.Build; Loading Loading @@ -77,8 +78,13 @@ public class ScheduleBoostWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.schedule_boost)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); } else { return Futures.immediateFuture(new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build())); } } @NonNull private ForegroundInfo createForegroundInfo() { Loading @@ -97,8 +103,13 @@ public class ScheduleBoostWorker extends Worker { .setContentText(getApplicationContext().getString(R.string.schedule_boost)) .setDefaults(NotificationCompat.DEFAULT_ALL) .setPriority(Notification.PRIORITY_DEFAULT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); } else { return new ForegroundInfo(NOTIFICATION_INT_CHANNEL_ID, notificationBuilder.build()); } } private OkHttpClient getOkHttpClient() { Loading