KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My MainActicity starts RefreshService with a Intent which has a boolean extra called isNextWeek . My RefreshService makes a Notification which starts my MainActivity when the user clicks on it. this looks like this: Log.d("Refresh", "RefreshService got: isNextWeek: " + String.valueOf(isNextWeek)); Intent notificationIntent = new Intent(this, MainActivity.class); notificationIntent.putExtra(MainActivity.IS_NEXT_WEEK, isNextWeek); Log.d("Refresh", "RefreshService put in Intent: isNextWeek: " + String.valueOf(notificationIntent.getBooleanExtra(MainActivity.IS_NEXT_WEEK,false))); pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); builder = new NotificationCompat.Builder(this).setContentTitle("Title").setContentText("ContentText").setSmallIcon(R.drawable.ic_notification).setContentIntent(pendingIntent); notification = builder.build(); // Hide the notification after its selected notification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(NOTIFICATION_REFRESH, notification); As you can see the notificationIntent should have the boolean extra IS_NEXT_WEEK with the value of isNextWeek which is put in the PendingIntent . When I click now this Notification I always get false as value of isNextWeek This is the way I get the value in the MainActivity : isNextWeek = getIntent().getBooleanExtra(IS_NEXT_WEEK, false); Log: 08-04 00:19:32.500 13367-13367/de.MayerhoferSimon.Vertretungsplan D/Refresh: MainActivity sent: isNextWeek: true 08-04 00:19:32.510 13367-13573/de.MayerhoferSimon.Vertretungsplan D/Refresh: RefreshService
Tags (comma-separated)
Save Edits
Cancel