-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dep(@notifee/react-native): registerForegroundService as early as pos…
…sible
- Loading branch information
1 parent
3b67930
commit a9d6e2b
Showing
3 changed files
with
45 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
import './react/index.native'; | ||
import notifee, {EventType} from '@notifee/react-native'; | ||
Check failure on line 2 in index.android.js
|
||
import logger from './react/features/app/logger'; | ||
|
||
// Needs to be registered outside any React components as early as possible | ||
await notifee.registerForegroundService(() => { | ||
return new Promise(resolve => { | ||
logger.warn('Foreground service running'); | ||
|
||
notifee.onBackgroundEvent(async event => { | ||
if (event.type === EventType.ACTION_PRESS && event.detail.pressAction.id === 'hang-up') { | ||
console.log('HANG UP BUTTON PRESSED BACKGROUND'); | ||
} | ||
|
||
return resolve(); | ||
}); | ||
|
||
notifee.onForegroundEvent(async ({ type, detail }) => { | ||
if (type === EventType.ACTION_PRESS && detail.pressAction.id === 'hang-up') { | ||
console.log('HANG UP BUTTON PRESSED'); | ||
} | ||
|
||
return resolve(); | ||
}); | ||
}); | ||
}); |
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