diff options
author | bunnei <bunneidev@gmail.com> | 2022-12-18 08:25:46 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:26 +0200 |
commit | bb2cbbfba3ba255c11953f2bcca912046519cfb1 (patch) | |
tree | b72691480e35039d67c0bd703596f1ae214bdaa7 /src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java | |
parent | cmake: Integrate bundled FFmpeg for Android. (diff) | |
download | yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar.gz yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar.bz2 yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar.lz yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar.xz yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.tar.zst yuzu-bb2cbbfba3ba255c11953f2bcca912046519cfb1.zip |
Diffstat (limited to 'src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java')
-rw-r--r-- | src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java b/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java new file mode 100644 index 000000000..41ac7e27c --- /dev/null +++ b/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java @@ -0,0 +1,56 @@ +// Copyright 2019 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +package org.citra.citra_emu; + +import android.app.Application; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.content.Context; +import android.os.Build; + +import org.citra.citra_emu.model.GameDatabase; +import org.citra.citra_emu.utils.DirectoryInitialization; +import org.citra.citra_emu.utils.PermissionsHandler; + +public class CitraApplication extends Application { + public static GameDatabase databaseHelper; + private static CitraApplication application; + + private void createNotificationChannel() { + // Create the NotificationChannel, but only on API 26+ because + // the NotificationChannel class is new and not in the support library + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + CharSequence name = getString(R.string.app_notification_channel_name); + String description = getString(R.string.app_notification_channel_description); + 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); + notificationManager.createNotificationChannel(channel); + } + } + + @Override + public void onCreate() { + super.onCreate(); + application = this; + + if (PermissionsHandler.hasWriteAccess(getApplicationContext())) { + DirectoryInitialization.start(getApplicationContext()); + } + + NativeLibrary.LogDeviceInfo(); + createNotificationChannel(); + + databaseHelper = new GameDatabase(this); + } + + public static Context getAppContext() { + return application.getApplicationContext(); + } +} |