Ionic history in detail page is reset sometimes

I am sorry that I cannot give you the code here as it is in dev. and client’s app.

Third party library:
Firebase is being used and ionic material is the theme.

The app is master detail page based on side menu. The master page has collection-repeat and clicking on the item, takes to the detail page. On detail page, the history is maintained and a back icon is shown on the top left corner as needed. OS is Android 4.4.4. When the app is in background and clicked on the icon brings it in foreground, when I click on the item, it goes to detail page, the history is reset and the back icon is not shown. Only the side menu icon is shown. Even the back hardware button exits the app and not go back to the master page.

Don’t know the problem. Has anyone faced the same situation?