Package org.robolectric.shadows
Class ShadowPendingIntent
java.lang.Object
org.robolectric.shadows.ShadowPendingIntent
@Implements(android.app.PendingIntent.class) public class ShadowPendingIntent extends Object
-
Constructor Summary
Constructors Constructor Description ShadowPendingIntent()
-
Method Summary
Modifier and Type Method Description protected static void
__staticInitializer__()
boolean
callLastOnFinished(Intent intent, int resultCode, String resultData, Bundle resultExtras)
protected void
cancel()
boolean
equals(Object o)
protected static PendingIntent
getActivities(Context context, int requestCode, Intent[] intents, int flags)
protected static PendingIntent
getActivities(Context context, int requestCode, Intent[] intents, int flags, Bundle options)
protected static PendingIntent
getActivity(Context context, int requestCode, Intent intent, int flags)
protected static PendingIntent
getActivity(Context context, int requestCode, Intent intent, int flags, Bundle options)
protected static PendingIntent
getBroadcast(Context context, int requestCode, Intent intent, int flags)
protected String
getCreatorPackage()
int
getFlags()
protected static PendingIntent
getForegroundService(Context context, int requestCode, Intent intent, int flags)
protected IntentSender
getIntentSender()
int
getRequestCode()
Context
getSavedContext()
Intent
getSavedIntent()
This returns the last Intent in the Intent[] to be delivered when the PendingIntent is sent.Intent[]
getSavedIntents()
This method is particularly useful for PendingIntents created with multiple Intents:getActivities(Context, int, Intent[], int)
getActivities(Context, int, Intent[], int, Bundle)
protected static PendingIntent
getService(Context context, int requestCode, Intent intent, int flags)
protected String
getTargetPackage()
int
hashCode()
boolean
isActivityIntent()
boolean
isBroadcastIntent()
boolean
isCanceled()
boolean
isForegroundServiceIntent()
boolean
isServiceIntent()
static PendingIntent
readPendingIntentOrNullFromParcel(Parcel in)
static void
reset()
protected void
send()
protected void
send(int code)
protected void
send(int code, PendingIntent.OnFinished onFinished, Handler handler)
protected void
send(Context context, int code, Intent intent)
protected void
send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler)
protected void
send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission)
protected void
send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission, Bundle options)
void
setCreatorPackage(String creatorPackage)
static void
writePendingIntentOrNullToParcel(PendingIntent sender, Parcel out)
protected void
writeToParcel(Parcel out, int flags)
-
Constructor Details
-
ShadowPendingIntent
public ShadowPendingIntent()
-
-
Method Details
-
__staticInitializer__
-
getActivity
@Implementation protected static PendingIntent getActivity(Context context, int requestCode, Intent intent, int flags) -
getActivity
@Implementation protected static PendingIntent getActivity(Context context, int requestCode, Intent intent, int flags, Bundle options) -
getActivities
@Implementation protected static PendingIntent getActivities(Context context, int requestCode, Intent[] intents, int flags) -
getActivities
@Implementation protected static PendingIntent getActivities(Context context, int requestCode, Intent[] intents, int flags, Bundle options) -
getBroadcast
@Implementation protected static PendingIntent getBroadcast(Context context, int requestCode, Intent intent, int flags) -
getService
@Implementation protected static PendingIntent getService(Context context, int requestCode, Intent intent, int flags) -
getForegroundService
@Implementation(minSdk=26) protected static PendingIntent getForegroundService(Context context, int requestCode, Intent intent, int flags) -
cancel
-
send
- Throws:
PendingIntent.CanceledException
-
send
- Throws:
PendingIntent.CanceledException
-
send
@Implementation protected void send(int code, PendingIntent.OnFinished onFinished, Handler handler) throws PendingIntent.CanceledException- Throws:
PendingIntent.CanceledException
-
send
@Implementation protected void send(Context context, int code, Intent intent) throws PendingIntent.CanceledException- Throws:
PendingIntent.CanceledException
-
send
@Implementation protected void send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler) throws PendingIntent.CanceledException- Throws:
PendingIntent.CanceledException
-
send
@Implementation protected void send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission) throws PendingIntent.CanceledException- Throws:
PendingIntent.CanceledException
-
send
@Implementation(minSdk=23) protected void send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission, Bundle options) throws PendingIntent.CanceledException- Throws:
PendingIntent.CanceledException
-
getIntentSender
-
isActivityIntent
public boolean isActivityIntent()- Returns:
true
iff sending this PendingIntent will start an activity
-
isBroadcastIntent
public boolean isBroadcastIntent()- Returns:
true
iff sending this PendingIntent will broadcast an Intent
-
isServiceIntent
public boolean isServiceIntent()- Returns:
true
iff sending this PendingIntent will start a service
-
isForegroundServiceIntent
public boolean isForegroundServiceIntent()- Returns:
true
iff sending this PendingIntent will start a foreground service
-
getSavedContext
- Returns:
- the context in which this PendingIntent was created
-
getSavedIntent
This returns the last Intent in the Intent[] to be delivered when the PendingIntent is sent. This method is particularly useful for PendingIntents created with a single Intent:- Returns:
- the final Intent to be delivered when the PendingIntent is sent
-
getSavedIntents
This method is particularly useful for PendingIntents created with multiple Intents:- Returns:
- all Intents to be delivered when the PendingIntent is sent
-
isCanceled
public boolean isCanceled()- Returns:
- iff this PendingIntent has been canceled
-
getRequestCode
public int getRequestCode()- Returns:
- the request code with which this PendingIntent was created
-
getFlags
public int getFlags()- Returns:
- the flags with which this PendingIntent was created
-
callLastOnFinished
public boolean callLastOnFinished(Intent intent, int resultCode, String resultData, Bundle resultExtras)CallsPendingIntent.OnFinished.onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle)
on the lastPendingIntent.OnFinished
passed withsend()
.PendingIntent.OnFinished.onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle)
is called on theHandler
passed withsend()
(if any). If noHandler
was provided it's invoked on the calling thread.- Returns:
- false if no
PendingIntent.OnFinished
callback was passed with the lastsend()
call, true otherwise.
-
getTargetPackage
-
getCreatorPackage
-
setCreatorPackage
-
equals
-
hashCode
-
readPendingIntentOrNullFromParcel
-
writePendingIntentOrNullToParcel
@Implementation public static void writePendingIntentOrNullToParcel(@Nullable PendingIntent sender, Parcel out) -
writeToParcel
-
reset
-