I am trying to pass in a bundle from App1 with some data which its data class is Auxiliar to an App2 which also has defined Auxiliar data class but I get the following error:
E/Parcel: Class not found when unmarshalling: com.opp.App1.ui.main.Auxiliar
I think that App2 is trying to find Auxiliar definition when retrieving bundle info and I don't know how to say to use Auxiliar defined in App2
Here is some code
@Parcelize
data class Auxiliar(
var nightId: Long = 0L,
val startTimeMilli: Long = System.currentTimeMillis(),
var endTimeMilli: Long = startTimeMilli,
var quality: Int = -1
): Parcelable
App1
var intent: Intent? = activity?.packageManager?.getLaunchIntentForPackage("com.opp.App2")
val argu1 = Auxiliar(-101, 1,1,-1)
if (intent != null) {
var bundle = Bundle()
bundle.putParcelable("una", argu1)
intent.putExtra("myBundle",bundle)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}
Retrieve in App2:
val bundle = activity?.intent?.getBundleExtra("myBundle")
if (bundle != null) {
var una = bundle.getParcelable<Auxiliar>("una")
}