PendingIntent

public static PendingIntent getBroadcast(Context context, int requestCode,
            Intent intent, @Flags int flags);
public static PendingIntent getActivities(Context context, int requestCode,
            @NonNull Intent[] intents, @Flags int flags);
public static PendingIntent getActivity(Context context, int requestCode,
            Intent intent, @Flags int flags);
public static PendingIntent getBroadcast(Context context, int requestCode,
            Intent intent, @Flags int flags);
public static PendingIntent getService(Context context, int requestCode,
            @NonNull Intent intent, @Flags int flags);
public static PendingIntent getForegroundService(Context context, int requestCode,
            @NonNull Intent intent, @Flags int flags);

坑1.发送的广播接收不到
解决:创建PendingIntent时指定接收广播的receiver
坑2.连续创建两个PendingIntent,只有extra不同,接收到的广播只有一个值
解决:只能通过更改action才行

你可能感兴趣的:(PendingIntent)