getBroadcast和getService的requestCode的请求代码可以相同吗?
例如,
Intent intent = new Intent(INTENT_FILTER);
PendingIntent sender = PendingIntent.getBroadcast(ctx, requestCode, intent, PendingIntent.FLAG_CANCEL_CURRENT);
am.cancel(sender);
sender.cancel();
Intent intentS = new Intent(ctx, MyService.class);
PendingIntent senderS = PendingIntent.getService(ctx, requestCode, intentS, PendingIntent.FLAG_CANCEL_CURRENT);
am.cancel(senderS);
senderS.cancel();
最佳答案
是。因为还有其他因素可用于区分PendingIntent
。在您的情况下,sender
具有ACTION,而senderS
没有ACTION,但是具有组件(包和类)。
关于java - PendingIntent的getBroadcast和getService,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30440666/