updated fgservice location
This commit is contained in:
parent
395a242d44
commit
926914e3c4
1 changed files with 37 additions and 0 deletions
37
app/services/ForegroundService.js
Normal file
37
app/services/ForegroundService.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
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()
|
||||
)
|
||||
},
|
||||
})
|
Loading…
Reference in a new issue