# Foreground Service that run after user kill the app

**URL:** <https://forum.ionicframework.com/t/foreground-service-that-run-after-user-kill-the-app/187174>\
**Category:** ionic-v3\
**Created:** [April 13, 2020, 7:08am UTC](https://forum.ionicframework.com/t/foreground-service-that-run-after-user-kill-the-app/187174 "2020-04-13T07:08:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deathrake](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@deathrake](https://forum.ionicframework.com/u/deathrake)\
**Post date:** [April 13, 2020, 7:08am UTC](https://forum.ionicframework.com/t/foreground-service-that-run-after-user-kill-the-app/187174/1 "2020-04-13T07:08:37Z")

</div>

Hello Guys,

i am new to ionic and was figuring out a way to run a piece of code in my app even after users kills it just like Avg antivirus. i tried background mode plugin from katzer it works but when users kills it from memory the app stops. Do i have to write my whole app in native code in android studio ?

any suggeestions or workaround is greatly appreciated

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [April 13, 2020, 11:16am UTC](https://forum.ionicframework.com/t/foreground-service-that-run-after-user-kill-the-app/187174/2 "2020-04-13T11:16:47Z")

</div>

So you will not be able to run Typescript/Javascript Code after the App was killed. This Code only runs within your WebView and this gets killed when app is. So to perform this you need to build a own native Plugin, which handles a Foreground Service and includes the Code that you want to run in Background.

---

<div class="post-metadata">

**Author:** ![deathrake](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@deathrake](https://forum.ionicframework.com/u/deathrake)\
**Post date:** [April 13, 2020, 2:15pm UTC](https://forum.ionicframework.com/t/foreground-service-that-run-after-user-kill-the-app/187174/3 "2020-04-13T14:15:48Z")

</div>

> [@EinfachHans](#):
>
> So to perform this you need to build a own native Plugin, which handles a Foreground Service and includes the Code that you want to run in Background.

Thanks a lot any guide that would help me building plugin is greatly appreciated
