-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VoximplantDemo]: add missing foreground service for android
- Loading branch information
1 parent
ffa16d6
commit db8fc72
Showing
6 changed files
with
64 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
// /* | ||
// * Copyright (c) 2011-2022, Zingaya, Inc. All rights reserved. | ||
// */ | ||
// | ||
// import VIForegroundService from '@voximplant/react-native-foreground-service'; | ||
// | ||
// class ForegroundService { | ||
// static instance = null; | ||
// | ||
// constructor() { | ||
// this.service = VIForegroundService.getInstance(); | ||
// } | ||
// | ||
// static getInstance () { | ||
// if (this.instance === null) { | ||
// this.instance = new ForegroundService(); | ||
// } | ||
// return this.instance; | ||
// } | ||
// | ||
// async createNotificationChannel() { | ||
// const channelConfig = { | ||
// id: 'ForegroundServiceChannel', | ||
// name: 'In progress calls', | ||
// description: 'Notify the call is in progress', | ||
// enableVibration: false, | ||
// }; | ||
// await this.service.createNotificationChannel(channelConfig); | ||
// } | ||
// | ||
// async startService() { | ||
// const notificationConfig = { | ||
// channelId: 'ForegroundServiceChannel', | ||
// id: 3456, | ||
// title: 'Voximplant', | ||
// text: 'Call in progress', | ||
// icon: 'ic_vox_notification', | ||
// }; | ||
// await this.service.startService(notificationConfig); | ||
// } | ||
// | ||
// async stopService() { | ||
// await this.service.stopService(); | ||
// } | ||
// } | ||
// export default ForegroundService; | ||
/* | ||
* Copyright (c) 2011-2022, Zingaya, Inc. All rights reserved. | ||
*/ | ||
|
||
import VIForegroundService from '@voximplant/react-native-foreground-service'; | ||
|
||
class ForegroundService { | ||
static instance = null; | ||
|
||
constructor() { | ||
this.service = VIForegroundService.getInstance(); | ||
} | ||
|
||
static getInstance() { | ||
if (this.instance === null) { | ||
this.instance = new ForegroundService(); | ||
} | ||
return this.instance; | ||
} | ||
|
||
async createNotificationChannel() { | ||
const channelConfig = { | ||
id: 'ForegroundServiceChannel', | ||
name: 'In progress calls', | ||
description: 'Notify the call is in progress', | ||
enableVibration: false, | ||
}; | ||
await this.service.createNotificationChannel(channelConfig); | ||
} | ||
|
||
async startService() { | ||
const notificationConfig = { | ||
channelId: 'ForegroundServiceChannel', | ||
id: 3456, | ||
title: 'Voximplant', | ||
text: 'Call in progress', | ||
icon: 'ic_vox_notification', | ||
}; | ||
await this.service.startService(notificationConfig); | ||
} | ||
|
||
async stopService() { | ||
await this.service.stopService(); | ||
} | ||
} | ||
export default ForegroundService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// /* | ||
// * Copyright (c) 2011-2022, Zingaya, Inc. All rights reserved. | ||
// */ | ||
// | ||
// 'use strict'; | ||
// | ||
// // do nothing for iOS. This functionality is required only on Android to work calls in background. | ||
/* | ||
* Copyright (c) 2011-2022, Zingaya, Inc. All rights reserved. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// do nothing for iOS. This functionality is required only on Android to work calls in background. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters