Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

4.1K
Views
La orientación a S+ (versión 31 y superior) requiere que se especifique uno de FLAG_IMMUTABLE o FLAG_MUTABLE

La aplicación falla en tiempo de ejecución con el siguiente error:

java.lang.IllegalArgumentException: maa.abc: la orientación a S+ (versión 31 y superior) requiere que se especifique FLAG_IMMUTABLE o FLAG_MUTABLE al crear un PendingIntent. Considere seriamente usar FLAG_IMMUTABLE, solo use FLAG_MUTABLE si alguna funcionalidad depende de que PendingIntent sea mutable, por ejemplo, si necesita usarse con respuestas en línea o burbujas. en android.app.PendingIntent.checkFlags(PendingIntent.java:375) en android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) en android.app.PendingIntent.getBroadcast(PendingIntent.java:632) en com.google. android.exoplayer2.ui.PlayerNotificationManager.createBroadcastIntent(PlayerNotificationManager.java:1373) en com.google.android.exoplayer2.ui.PlayerNotificationManager.createPlaybackActions(PlayerNotificationManager.java:1329) en com.google.android.exoplayer2.ui.PlayerNotificationManager. (PlayerNotificationManager.java:643) en com.google.android.exoplayer2.ui.PlayerNotificationManager.(PlayerNotificationManager.java:529) en com.google.android.exoplayer2.ui.PlayerNotificationManager.createWithNotificationChannel(PlayerNotificationManager.java:456) en com .google.android.exoplayer2.ui.PlayerNotificationManager.createWithNotificationChannel(PlayerNotificationManager.java:417)

Probé todas las soluciones disponibles, pero la aplicación sigue fallando en Android 12.

 @Nullable @Override public PendingIntent createCurrentContentIntent(@NonNull Player player) { Intent intent = new Intent(service, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); return PendingIntent.getActivity(service, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); }
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Verifique y actualice la versión de dependencia de exoplayer a la última

android.app.PendingIntent.getBroadcast() utilizado anteriormente para devolver

 @Nullable @Override private static PendingIntent createBroadcastIntent( String action, Context context, int instanceId) { Intent intent = new Intent(action).setPackage(context.getPackageName()); intent.putExtra(EXTRA_INSTANCE_ID, instanceId); return PendingIntent.getBroadcast( context, instanceId, intent, PendingIntent.FLAG_UPDATE_CURRENT); }

Si observa cuidadosamente, falta PendingIntent.FLAG_IMMUTABLE aquí en el fragmento anterior

Ahora se ha actualizado para devolver lo siguiente

 @Nullable @Override private static PendingIntent createBroadcastIntent( String action, Context context, int instanceId) { Intent intent = new Intent(action).setPackage(context.getPackageName()); intent.putExtra(EXTRA_INSTANCE_ID, instanceId); int pendingFlags; if (Util.SDK_INT >= 23) { pendingFlags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE; } else { pendingFlags = PendingIntent.FLAG_UPDATE_CURRENT; } return PendingIntent.getBroadcast(context, instanceId, intent, pendingFlags); }
over 4 years ago · Santiago Trujillo Report

0

Si usa java o react-native, pegue esto dentro de app/build.gradle

 dependencies { // ... implementation 'androidx.work:work-runtime:2.7.1' }

Si usa Kotlin, use esto

 dependencies { // ... implementation 'androidx.work:work-runtime-ktx:2.7.0' }

y si alguien todavía enfrenta el problema de bloqueo para Android 12, asegúrese de agregar lo siguiente en AndroidMenifest.xml

 <activity ... android:exported="true" // in most cases it is true but based on requirements it can be false also > // If using react-native push notifications then make sure to add into it also <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver" android:exported="true"> // Similarly <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="true">

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!