Is Request request always supported in PendingIntent?

I am trying to distinguish different instances of PendingIntent with a separate requestCode for each use case, as suggested earlier.

Is this a reliable solution? Is requestCode always supported, although javadocs still say it's "not currently in use"?

+6
source share
1 answer

Yes. requestCode has always been there. It is currently not used by the Android platform for anything other than as part of a test for PendingIntent matching . Using requestCode to define various PendingIntent is reliable and supported. the documentation even says this:

  • If you really need several different PendingIntent objects working at the same time (for example, to display two notifications simultaneously), you will need to make sure that they have something else to associate them with different PendingIntents. This can be any of the Intent attributes examined by Intent.filterEquals , or different integer code codes provided by getActivity(Context, int, Intent, int) , getActivities(Context, int, Intent[], int) , getBroadcast(Context, int, Intent, int) or getService(Context, int, Intent, int) .
+4
source

Source: https://habr.com/ru/post/924923/


All Articles