My Android app has a notification open handler (using OneSignal push notifications) and what it does is, when a push notification is received and the user taps on it, the app comes to foreground and opens an activity with the details of a product.
This works perfectly fine when the app is in background or foreground, but the problem arrises when the app is closed: the push notification arrives, the user taps on it, the app starts but goes directly to the product detail. It seems that the MainActivity, where the product list is shown, is not loading... Then, when I click the back button, the app dismisses, like it doesn't have history to go back...
The code I'm using in the push notification callback is:
Intent intentProduct = new Intent(getApplicationContext(), ProductDetailActivity.class);
intentProduct.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
ItemParcel pProduct = new ItemParcel();
pProduct.setId(id);
intentProduct.putExtra("ItemParcel", pProduct);
startActivity(intentProduct);
It seems that some of these flags on the intent is not doing the right thing, but this exactly what is on the OneSignal docs.
Another this I added to the manifest (according to Onesignal docs) is:
<meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" />
Any ideias on how to fix this?