0
votes

I am developing an alarm.

I have a data class (Parcelable).

So when I create the alarm, I pass the object into the intent.

But when I got the alarm in BroadcastReceiver, there are no data.

So I tested something.

When I put "String" instead of "Parcelable" class, it works fine!!!

Only when I put "Parcleable" data, it doesn't work!!!

Oh! I tested with Serializable, but it doesn't work too.

My Parcelable class is defined using "Kotlin - @Parcelize". So I removed the annotation and implemented the Parcelable by my-self. But the result same. (Not work)

And the Parcelable class is "data class". So I tried to change it to "class", but the result same...

Does AlarmManager only support a primitive type with String?

Or... is it the android bug?

2

2 Answers

0
votes

Wow...

It is intended behavior...

I found a link...

https://issuetracker.google.com/issues/37112802

I still don't know why it is intended behavior...

0
votes

The annotation of @Parcelize will auto generate parcelize funcation with your parcelable member in your class.

The others which are not parcelable member still need to handle by yourself.

And same as Serialize.

I'm surely intent with broadcast can pass serialize object (such as ArrayList<String>), so I guess there is something member you have not handle yet.