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__()booleancallLastOnFinished(Intent intent, int resultCode, String resultData, Bundle resultExtras)protected voidcancel()booleanequals(Object o)protected static PendingIntentgetActivities(Context context, int requestCode, Intent[] intents, int flags)protected static PendingIntentgetActivities(Context context, int requestCode, Intent[] intents, int flags, Bundle options)protected static PendingIntentgetActivity(Context context, int requestCode, Intent intent, int flags)protected static PendingIntentgetActivity(Context context, int requestCode, Intent intent, int flags, Bundle options)protected static PendingIntentgetBroadcast(Context context, int requestCode, Intent intent, int flags)protected StringgetCreatorPackage()intgetFlags()protected static PendingIntentgetForegroundService(Context context, int requestCode, Intent intent, int flags)protected IntentSendergetIntentSender()intgetRequestCode()ContextgetSavedContext()IntentgetSavedIntent()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 PendingIntentgetService(Context context, int requestCode, Intent intent, int flags)protected StringgetTargetPackage()inthashCode()booleanisActivityIntent()booleanisBroadcastIntent()booleanisCanceled()booleanisForegroundServiceIntent()booleanisServiceIntent()static PendingIntentreadPendingIntentOrNullFromParcel(Parcel in)static voidreset()protected voidsend()protected voidsend(int code)protected voidsend(int code, PendingIntent.OnFinished onFinished, Handler handler)protected voidsend(Context context, int code, Intent intent)protected voidsend(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler)protected voidsend(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission)protected voidsend(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission, Bundle options)voidsetCreatorPackage(String creatorPackage)static voidwritePendingIntentOrNullToParcel(PendingIntent sender, Parcel out)protected voidwriteToParcel(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:
trueiff sending this PendingIntent will start an activity
-
isBroadcastIntent
public boolean isBroadcastIntent()- Returns:
trueiff sending this PendingIntent will broadcast an Intent
-
isServiceIntent
public boolean isServiceIntent()- Returns:
trueiff sending this PendingIntent will start a service
-
isForegroundServiceIntent
public boolean isForegroundServiceIntent()- Returns:
trueiff 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.OnFinishedpassed withsend().PendingIntent.OnFinished.onSendFinished(android.app.PendingIntent, android.content.Intent, int, java.lang.String, android.os.Bundle)is called on theHandlerpassed withsend()(if any). If noHandlerwas provided it's invoked on the calling thread.- Returns:
- false if no
PendingIntent.OnFinishedcallback 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
-