0

I am using a push notification third-party solution (specifically RichPushMessage class from Urban Airship push notification lib). I have created a bundle to be passed about that contains a RichPushMessage field. I need it to implement Parcelable. I cannot subclass RichPushMessage as its constructor is private. How best to go about making this class parcelable?

David Walschots
  • 12,279
  • 5
  • 36
  • 59
RMcGuigan
  • 1,147
  • 2
  • 7
  • 11

1 Answers1

2

Even if you could subclass it, you would not be able to create a RichPushMessage as that is handled by the Urban Airship SDK.

I am not sure if its possible to do what you are asking, but here are a few alternatives:

1) Store the message ID in the bundle:

// Put it into the bundle
Bundle bundle = new Bundle();
bundle.putString(MESSAGE_ID_KEY, message.getMessageId());

// Pull it out of the bundle
String messageId = bundle.getString(MESSAGE_ID_KEY);
RichPushMessage message = UAirship.shared().getInbox().getMessage(messageId);

2) Create a class that wraps a RichPushMessage that you can make parcelable

ralepinski
  • 1,756
  • 8
  • 15