Ionic 3 - Device/App will not go to sleep after manually placing the app into the background and re-oping


#1

Hello, sorry if this should actually fall under the Cordova but I was not 100% sure.

So the issue is that the app/device will not go to sleep after it is manually placed into the background via either the home button, the recent app button or accessing google maps app via the app itself. However if you load the app, and then let it be, after the 15 second timeout for the screen, the app/device will sleep correctly and this functionality remains until the above criteria is triggered.

The device this is being tested on is a Samsung J5, Android 7.0 and the display timeout set to 15 seconds.

As a note, I am aware that the insomnia plugin is being used however the issue was the same before it was installed.

Any help or direction would be appreciated, thanks.

Here is my ionic info & package.json

Ionic:

   ionic (Ionic CLI)  : 4.1.2 (C:\Users\******\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
   Cordova Platforms     : android 7.1.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, (and 21 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\*****\AppData\Local\Android\Sdk)
   NodeJS            : v8.11.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10
{
  "name": "************",
  "version": "0.1.6.3",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "config": {
    "ionic_webpack": "./config/webpack.config.js",
    "ionic_uglifyjs": "./config/uglify.config.js",
    "ionic_enable_lint": false,
    "ionic_source_map_type": "eval"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/android-fingerprint-auth": "^4.7.0",
    "@ionic-native/app-version": "^4.9.0",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "^4.12.2",
    "@ionic-native/date-picker": "^4.7.0",
    "@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/google-maps": "^4.9.1",
    "@ionic-native/http": "^4.7.0",
    "@ionic-native/in-app-browser": "^4.7.0",
    "@ionic-native/insomnia": "^4.17.0",
    "@ionic-native/keyboard": "^4.15.0",
    "@ionic-native/network": "^4.7.0",
    "@ionic-native/screen-orientation": "^4.7.0",
    "@ionic-native/secure-storage": "^4.7.0",
    "@ionic-native/splash-screen": "4.6.0",
    "@ionic-native/sqlite": "^4.9.0",
    "@ionic-native/sqlite-porter": "^4.9.0",
    "@ionic-native/status-bar": "^4.7.0",
    "@ionic/storage": "^2.1.3",
    "@types/googlemaps": "^3.30.12",
    "asmcrypto.js": "^0.22.0",
    "cordova-android": "7.1.1",
    "cordova-browser": "5.0.4",
    "cordova-build-architecture": "git+https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.4",
    "cordova-custom-config": "^5.0.2",
    "cordova-plugin-advanced-http": "^1.11.1",
    "cordova-plugin-android-fingerprint-auth": "^1.4.5",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-datepicker": "^0.9.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-googlemaps": "^2.4.6",
    "cordova-plugin-inappbrowser": "^2.0.2",
    "cordova-plugin-insomnia": "4.3.0",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.1.4",
    "cordova-plugin-media-capture": "^3.0.2",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-screen-orientation": "^3.0.1",
    "cordova-plugin-secure-storage": "^2.6.8",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlcipher-adapter": "^0.1.12-rc2",
    "cors": "^2.8.4",
    "crypto-js": "^3.1.9-1",
    "es6-promise-plugin": "^4.2.2",
    "ionic-angular": "3.9.2",
    "ionic-cache": "^3.1.3",
    "ionic-img-viewer": "^2.9.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-super-tabs": "^4.2.2",
    "ionicons": "3.0.0",
    "minimist": "^1.2.0",
    "moment": "^2.22.1",
    "reflect-metadata": "^0.1.12",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "typeorm": "^0.2.7",
    "uk.co.workingedge.cordova.plugin.sqliteporter": "^1.0.5",
    "xml2js": "^0.4.19",
    "yarn": "^1.7.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.0",
    "@types/node": "^9.6.21",
    "sql.js": "^0.5.0",
    "tslint-ionic-rules": "0.0.16",
    "tslint-sonarts": "^1.8.0",
    "typescript": "^2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-android-fingerprint-auth": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "cordova-plugin-secure-storage": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-media-capture": {},
      "cordova-plugin-datepicker": {},
      "cordova-plugin-screen-orientation": {},
      "uk.co.workingedge.cordova.plugin.sqliteporter": {},
      "cordova-plugin-app-version": {},
      "cordova-sqlcipher-adapter": {},
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "test-test",
        "API_KEY_FOR_IOS": "test-test",
        "PLAY_SERVICES_VERSION": "15.0.1",
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-build-architecture": {},
      "cordova-custom-config": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-insomnia": {}
    },
    "platforms": [
      "browser",
      "android"
    ]
  },
  "platforms": [
    "android"
  ],
  "prettier": {
    "singleQuote": true,
    "trailingComma": "es5",
    "semi": true
  }
}```