PushState works only after device interaction

This is a peculier problem I am having. Pushstate works only after there is some device interations, like:

  • Focusing an input field
  • Opening camera
  • Locking screen and unlocking
  • Opening native share dialogue

This happens on 5 difference devices that I am using. So, not a device specific issue.

Here is my app.js snippet:
var app = new Framework7({
id: ‘com.skipqlah.userapp’,
root: ‘#app’,
theme: theme,
routes: routes,
view: {
touch: {
var mainView = app.views.create(’.view-main’);

I am using PhoneGap CLI 8.2.2
Android version 7.1.4

Two things:

  • pushState should be enabled only on main view
  • don’t use pushState in cordova/phonegap app at all!

Thanks for your suggestions. If I should not use pushstate, how should I go back from one page to previous page using Android hardware back button?

By handing Android backbutton, which is already done in project created with framework7 cli. Or just search the forum on how to handle android back button

For reference in case someone search for the same issue. The issue occurs when Cordova plugin splashscreen is installed. Check GitHub of the plugin for the solution.

1 Like