79767768

Date: 2025-09-17 20:05:13
Score: 1.5
Natty:
Report link

This answer shows how to set the PendingIntent flags with the NavDeepLinkBuilder by using createTaskStackBuilder: Missing mutability flags: Android 12 pending intents with NavDeepLinkBuilder

So:

PendingIntent pendingIntent = new NavDeepLinkBuilder(context)
                .setGraph(R.navigation.nav_graph)
                .setDestination(R.id.android)
                .createTaskStackBuilder()
                .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);

PendingIntent.FLAG_IMMUTABLE is required or an exception is thrown.

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: ceperman