I've been having trouble fixing this issue for weeks now, and still no luck. My app is keep getting rejected from PlayStore. I read https://support.google.com/faqs/answer/9267555?hl=en
and I tried option-1 adding exported=false
in every activity, but it didn't work. Then I tried option-2.
Activity 1
val intentProduct = Intent(context,ProductView::class.java)
intentProduct.putExtra("data",gson.toJson(item))
startActivity(intentProduct)
Activity 2
if (callingActivity != null && callingActivity!!.packageName == BuildConfig.APPLICATION_ID){
var product = gson.fromJson(intent.getStringExtra("data"), Product::class.java)
//other stuff
}
But when I try this I'm always getting NullPointerException because the callingActivity is always null, so because of that, it's going into the else condition.