所以我改变了我的代码来调用广播接收器而不是调用主要活动
Intent notificationIntent = new Intent(context, com.plugin.statusNotificationForGCM.statusNotificationForGCMReceiver.class);
notificationIntent.putExtra(NOTIF_RESPOND, runThis);
notificationIntent.setAction(Intent.ACTION_VIEW);
notificationIntent = notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
//contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
问题是我在我的接收器中添加了这个,但不认为它正在运行。单击通知时看不到标签并登录控制台
public class statusNotificationForGCMReceiver extends BroadcastReceiver {
private static final String TAG = "statusNOTIFICATIONReceiver";
@Override
public final void onReceive(Context context, Intent intent) {
Log.v(TAG,"ASDFSJD FASDF ASDPFJA SDFPAUS DFPAS DFASDF");
}
}
有什么我想念的吗?我必须在清单文件中添加一些东西吗?
谢谢