PendingIntentCompat
public final class PendingIntentCompat
Helper for accessing features in PendingIntent
.
Summary
Public methods |
|
---|---|
static @NonNull PendingIntent |
getActivities( Retrieves a |
static @NonNull PendingIntent |
getActivities( Retrieves a |
static @Nullable PendingIntent |
getActivity( Retrieves a |
static @Nullable PendingIntent |
getActivity( Retrieves a |
static @Nullable PendingIntent |
getBroadcast( Retrieves a |
static @NonNull PendingIntent |
@RequiresApi(value = 26) Retrieves a |
static @Nullable PendingIntent |
getService( Retrieves a |
static void |
send(
|
static void |
send(
|
static void |
send(
|
Public methods
getActivities
public static @NonNull PendingIntent getActivities(
@NonNull Context context,
int requestCode,
@NonNull Intent[] intents,
int flags,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary. See getActivities
.
getActivities
public static @NonNull PendingIntent getActivities(
@NonNull Context context,
int requestCode,
@NonNull Intent[] intents,
int flags,
@Nullable Bundle options,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary. See getActivities
.
getActivity
public static @Nullable PendingIntent getActivity(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary.
Returns | |
---|---|
@Nullable PendingIntent |
Returns an existing or new PendingIntent matching the given parameters. May return |
See also | |
---|---|
getActivity |
getActivity
public static @Nullable PendingIntent getActivity(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags,
@Nullable Bundle options,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary.
Returns | |
---|---|
@Nullable PendingIntent |
Returns an existing or new PendingIntent matching the given parameters. May return |
See also | |
---|---|
getActivity |
getBroadcast
public static @Nullable PendingIntent getBroadcast(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary.
Returns | |
---|---|
@Nullable PendingIntent |
Returns an existing or new PendingIntent matching the given parameters. May return |
See also | |
---|---|
getBroadcast |
getForegroundService
@RequiresApi(value = 26)
public static @NonNull PendingIntent getForegroundService(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary. See getForegroundService
.
getService
public static @Nullable PendingIntent getService(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags,
boolean isMutable
)
Retrieves a PendingIntent
with mandatory mutability flag set on supported platform versions. The caller provides the flag as combination of all the other values except mutability flag. This method combines mutability flag when necessary.
Returns | |
---|---|
@Nullable PendingIntent |
Returns an existing or new PendingIntent matching the given parameters. May return |
See also | |
---|---|
getService |
send
public static void send(
@NonNull PendingIntent pendingIntent,
int code,
@Nullable PendingIntent.OnFinished onFinished,
@Nullable Handler handler
)
send
variants that support PendingIntent.OnFinished
callbacks have a bug on many API levels that the callback may be invoked even if the PendingIntent was never sent (ie, such as if the PendingIntent was canceled, and the send() invocation threw a PendingIntent.CanceledException
). Using this compatibility method fixes that bug and guarantees that PendingIntent.OnFinished
callbacks will only be invoked if send() completed successfully.
See send
.
send
public static void send(
@NonNull PendingIntent pendingIntent,
@NonNull Context context,
int code,
@NonNull Intent intent,
@Nullable PendingIntent.OnFinished onFinished,
@Nullable Handler handler
)
send
variants that support PendingIntent.OnFinished
callbacks have a bug on many API levels that the callback may be invoked even if the PendingIntent was never sent (ie, such as if the PendingIntent was canceled, and the send() invocation threw a PendingIntent.CanceledException
). Using this compatibility method fixes that bug and guarantees that PendingIntent.OnFinished
callbacks will only be invoked if send() completed successfully.
See send
.
send
public static void send(
@NonNull PendingIntent pendingIntent,
@NonNull Context context,
int code,
@NonNull Intent intent,
@Nullable PendingIntent.OnFinished onFinished,
@Nullable Handler handler,
@Nullable String requiredPermissions,
@Nullable Bundle options
)
send
variants that support PendingIntent.OnFinished
callbacks have a bug on many API levels that the callback may be invoked even if the PendingIntent was never sent (ie, such as if the PendingIntent was canceled, and the send() invocation threw a PendingIntent.CanceledException
). Using this compatibility method fixes that bug and guarantees that PendingIntent.OnFinished
callbacks will only be invoked if send() completed successfully.
See send