diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index 0fcdc720f..9f83f1e53 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -58,7 +58,8 @@ + android:theme="@style/CitraEmulation" + android:launchMode="singleInstance"/> = Build.VERSION_CODES.O) { CharSequence name = getString(R.string.app_notification_channel_name); String description = getString(R.string.app_notification_channel_description); - int importance = NotificationManager.IMPORTANCE_DEFAULT; - NotificationChannel channel = new NotificationChannel(getString(R.string.app_notification_channel_id), name, importance); + NotificationChannel channel = new NotificationChannel(getString(R.string.app_notification_channel_id), name, NotificationManager.IMPORTANCE_LOW); channel.setDescription(description); + channel.setSound(null, null); + channel.setVibrationPattern(null); // Register the channel with the system; you can't change the importance // or other notification behaviors after this NotificationManager notificationManager = getSystemService(NotificationManager.class); diff --git a/src/android/app/src/main/java/org/citra/citra_android/activities/EmulationActivity.java b/src/android/app/src/main/java/org/citra/citra_android/activities/EmulationActivity.java index 783e8f0ac..23ad57c80 100644 --- a/src/android/app/src/main/java/org/citra/citra_android/activities/EmulationActivity.java +++ b/src/android/app/src/main/java/org/citra/citra_android/activities/EmulationActivity.java @@ -2,6 +2,7 @@ package org.citra.citra_android.activities; import android.app.Activity; import android.app.AlertDialog; +import android.app.PendingIntent; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -137,12 +138,18 @@ public final class EmulationActivity extends AppCompatActivity { } private void showRunningNotification() { + // Intent is used to resume emulation if the notification is clicked + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, + new Intent(this, EmulationActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); + NotificationCompat.Builder builder = new NotificationCompat.Builder(this, getString(R.string.app_notification_channel_id)) .setSmallIcon(R.drawable.ic_stat_notification_logo) .setContentTitle(getString(R.string.app_name)) .setContentText(getString(R.string.app_notification_running)) - .setPriority(NotificationCompat.PRIORITY_MIN) - .setOngoing(true); + .setPriority(NotificationCompat.PRIORITY_LOW) + .setVibrate(null) + .setSound(null) + .setContentIntent(contentIntent); NotificationManagerCompat.from(this).notify(EMULATION_RUNNING_NOTIFICATION, builder.build()); }