From 395a242d4482532046f97527e2d8a4d09e63d5c1 Mon Sep 17 00:00:00 2001 From: vishnuraghavb Date: Fri, 18 Jun 2021 21:52:24 +0530 Subject: [PATCH] updated fgservice location --- app/ForegroundService.js | 37 ------------------------------------- webpack.config.js | 2 +- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 app/ForegroundService.js diff --git a/app/ForegroundService.js b/app/ForegroundService.js deleted file mode 100644 index 5a9e4b64..00000000 --- a/app/ForegroundService.js +++ /dev/null @@ -1,37 +0,0 @@ -import { TimerNotif } from './shared/utils' -const superProto = android.app.Service.prototype - -android.app.Service.extend('com.tns.ForegroundService', { - onStartCommand: function(intent, flags, startId) { - superProto.onStartCommand.call(this, intent, flags, startId) - return android.app.Service.START_STICKY - }, - onCreate: function() { - superProto.onCreate.call(this) - this.startForeground(6, this.getNotification()) - }, - onBind: function(intent) { - return superProto.onBind.call(this, intent) - }, - onUnbind: function(intent) { - return superProto.onUnbind.call(this, intent) - }, - onDestroy: function() { - this.stopForeground(true) - }, - getNotification: function() { - return TimerNotif.getNotification( - { - bID: 'info', - cID: 'cti', - cName: 'Cooking Timer info', - description: `0 ongoing, 0 paused`, - nID: 6, - priority: -2, - sound: null, - title: 'EnRecipes is running', - }, - this.getApplicationContext() - ) - }, -}) diff --git a/webpack.config.js b/webpack.config.js index bc678552..9ed0f21b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,7 @@ module.exports = (env) => { const appComponents = [ '@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity', - path.resolve(__dirname, 'app/ForegroundService.js'), + path.resolve(__dirname, 'app/services/ForegroundService.js'), ] appComponents.map((component) => { config.entry('bundle').add(component)