diff --git a/app/src/main/java/com/vanced/manager/core/installer/AppInstaller.kt b/app/src/main/java/com/vanced/manager/core/installer/AppInstaller.kt index 084ab63a..2f218c3d 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/AppInstaller.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/AppInstaller.kt @@ -11,7 +11,7 @@ import java.io.InputStream class AppInstaller: Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - val app = if (intent.getStringExtra("pkg").contains("mgoogle")) "microg" else "music" + val app = if (intent?.getStringExtra("pkg")?.contains("mgoogle") == true) "microg" else "music" val callbackIntent = Intent(applicationContext, AppInstallerService::class.java).putExtra("app", app) val pendingIntent = PendingIntent.getService(applicationContext, 0, callbackIntent, 0) val packageInstaller = packageManager.packageInstaller diff --git a/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt index db878524..1cc947bf 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt @@ -17,7 +17,7 @@ class AppInstallerService: Service() { when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) { PackageInstaller.STATUS_PENDING_USER_ACTION -> { Log.d(TAG, "Requesting user confirmation for installation") - localBroadcastManager.sendBroadcast(Intent(if (intent.getStringExtra("app")) HomeFragment.MICROG_INSTALLING else HomeFragment.MUSIC_INSTALLING)) + localBroadcastManager.sendBroadcast(Intent(if (intent.getStringExtra("app") == "microg") HomeFragment.MICROG_INSTALLING else HomeFragment.MUSIC_INSTALLING)) val confirmationIntent = intent.getParcelableExtra(Intent.EXTRA_INTENT) confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) try { @@ -30,7 +30,7 @@ class AppInstallerService: Service() { Log.d(TAG, "Installation succeed") with(localBroadcastManager) { sendBroadcast(Intent(HomeFragment.REFRESH_HOME)) - sendBroadcast(Intent(if (intent.getStringExtra("app")) HomeFragment.MICROG_INSTALLING else HomeFragment.MUSIC_INSTALLING)) + sendBroadcast(Intent(if (intent.getStringExtra("app") == "microg") HomeFragment.MICROG_INSTALLING else HomeFragment.MUSIC_INSTALLING)) } } else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)