Skip to content

Commit

Permalink
fix: Android 14+ launch support (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandsLa committed Mar 5, 2024
1 parent 8b42df9 commit e5d1dc7
Showing 1 changed file with 9 additions and 1 deletion.
@@ -1,6 +1,7 @@
package es.antonborri.home_widget

import android.app.Activity
import android.app.ActivityOptions
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
Expand All @@ -21,7 +22,14 @@ object HomeWidgetLaunchIntent {
flags = flags or PendingIntent.FLAG_IMMUTABLE
}

return PendingIntent.getActivity(context, 0, intent, flags)
if (Build.VERSION.SDK_INT < 34) {
return PendingIntent.getActivity(context, 0, intent, flags)
}

val options = ActivityOptions.makeBasic()
options.pendingIntentBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED

return PendingIntent.getActivity(context, 0, intent, flags, options.toBundle())
}
}

Expand Down

0 comments on commit e5d1dc7

Please sign in to comment.