# I found a solution for some regular background activity!

**URL:** <https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012>\
**Category:** uncategorized\
**Created:** [June 23, 2015, 2:32pm UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012 "2015-06-23T14:32:13Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![vasanthb](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@vasanthb](https://forum.ionicframework.com/u/vasanthb)\
**Post date:** [May 27, 2019, 12:48pm UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/22 "2019-05-27T12:48:57Z")

</div>

Hi, Even I’m facing the same doubt ? any solution you found ?

---

<div class="post-metadata">

**Author:** ![jona35](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jona35](https://forum.ionicframework.com/u/jona35)\
**Post date:** [May 28, 2019, 7:17am UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/23 "2019-05-28T07:17:47Z")

</div>

No, I did not find a solution else

---

<div class="post-metadata">

**Author:** ![vasanthb](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@vasanthb](https://forum.ionicframework.com/u/vasanthb)\
**Post date:** [May 28, 2019, 7:22am UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/24 "2019-05-28T07:22:37Z")

</div>

You are also facing issues on receiving notifications when app is killed in Android 8 and above ?

---

<div class="post-metadata">

**Author:** ![jona35](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jona35](https://forum.ionicframework.com/u/jona35)\
**Post date:** [May 28, 2019, 7:32am UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/25 "2019-05-28T07:32:59Z")

</div>

No, I believe that we don’t have the same problem, in my case I don’t receive any notification, I want simply that my application keep running even if the screen is sleeping. There is no error in my code but I want to apply the @boltex’s solution but it doesn’t work and I don’t know where I must put the code above

---

<div class="post-metadata">

**Author:** ![jona35](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jona35](https://forum.ionicframework.com/u/jona35)\
**Post date:** [May 28, 2019, 8:25am UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/26 "2019-05-28T08:25:47Z")

</div>

please, help me… where I should implement this code:

```auto
if( ionic.Platform.isAndroid() ){
cordova.plugins.backgroundMode.enable();

window.powerManagement.dim(function() {
  console.log('Wakelock acquired');
}, function() {
  console.log('Failed to acquire wakelock');
});
window.powerManagement.setReleaseOnPause(false, function() {
  console.log('setReleaseOnPause successfully');
}, function() {
  console.log('Failed to set');
});
}

```

---

<div class="post-metadata">

**Author:** ![selimkayali](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@selimkayali](https://forum.ionicframework.com/u/selimkayali)\
**Post date:** [July 10, 2019, 7:59pm UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/27 "2019-07-10T19:59:47Z")

</div>

```auto
  initializeApp() {
    this.platform.ready().then(() => {
      this.powerManagement.dim().then(
        res => console.log('Wakelock acquired'),
        () => {
          console.log('Failed to acquire wakelock');
        }
      );
      this.powerManagement.setReleaseOnPause(false).then(
        res => console.log('setReleaseOnPause successfully'),
        () => {
          console.log('Failed to set');
        }
      );
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

```

You can put it in app.component.ts ( I am using v4 )

I put code here, and edit. My screen didn’t close but background app still work like 5 mins. It is not a completely solution for Android v8.

---

<div class="post-metadata">

**Author:** ![chrissiarivera](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@chrissiarivera](https://forum.ionicframework.com/u/chrissiarivera)\
**Post date:** [September 7, 2019, 2:38pm UTC](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012/28 "2019-09-07T14:38:17Z")

</div>

Hi! How did you import the power management app? I get this error

> Property ‘powerManagement’ does not exist on type ‘MyApp’

[Previous page](https://forum.ionicframework.com/t/i-found-a-solution-for-some-regular-background-activity/27012.md?page=1)
