1

I'm writing an Android Application. In this App the user should be able to recieve Notifications in the future. I'm using AlarmManager to send a Broadcast to my Reciever which has an Intent inside with the Notification as Parceled Extra. I don't want to put the whole Code here (its much), so I'm explaining just the workflow and put relevant code here.

I have extended Notification to let itself have an id and an Object from my Model (Model is Parcelable). I take care that the Notification gets Parcelled and unparcelled before my Model.

To send an Alarm I would create a new Notification Instance and call setLatestEventInfo with data from the Model. If I push this Notification directly, everything is fine.

After that, I create a new Pending-Broadcast-Intent. the Intent, which is put inside the Broadcast gets my Notification as ParcelableExtra. Then I fire that PendingIntent Via AlarmManager.set(). if time has come, I recieve the Broadcast in my BroadcastReciever.

I take the extras from my Intent and want to look, id theres a Key "NotificationExtra" which I used to store it. in that call I get an ClassCastException. If you are intereseted in some Code samples, feel free to ask. Any Idea what can go wrong? can I store null Values as Parcelables? And If I can store null values, can they be read properly?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.