-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MM-54553 - Calls: Enable microphone input in background (Android) #7585
Conversation
That doesn't sound great. It's not that rare to be waiting a minute or so in silence before a large meeting and a mobile user may actually take the time to do other stuff. I'd definitely want to track this to investigate further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add to Claudio's comment, taken from iOS docs
Use background execution modes sparingly because overuse can negatively impact device performance and battery life. If an alternative to executing in the background exists, use the alternative instead. For example, apps can use the significant-change location service to receive location events as an alternative to using the Location updates background mode.
Have we measure the impact on battery and device perf?
See https://developer.apple.com/documentation/xcode/configuring-background-execution-modes
}; | ||
|
||
export const foregroundServiceStart = async () => { | ||
await VIForegroundService.getInstance().createNotificationChannel(channelConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why create the notification channel every time it starts? Creating the channel once should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling it again with the same params is a noop, but just to be clean I separated it into a setup call. 👍
I've created https://mattermost.atlassian.net/browse/MM-54765 . I still think this would be rare, but I'll look to see if there's a simple way to keep the connection alive. |
I removed iOS changes from this PR, to keep it focused on fixing the Android issue. I'll tackle that in https://mattermost.atlassian.net/browse/MM-54765 @enahum What method have we used in the past to measure the impact of PRs on battery and device perf? (so that I can use that in the next PR) |
I normally check the battery app report, also you can use xcode instrumentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great fix! 💯
I am only slightly concerned about the added dependency which doesn't seem the most frequently used nor up to date one but I guess we may always provide a custom implementation in the future if necessary.
export const foregroundServiceStart = async () => { | ||
const notificationConfig = { | ||
channelId: 'calls_channel', | ||
id: 345678, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be some logic behind the id value? Should it be a constant somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's completely arbitrary (just has to be unique for the channel), and since we're not using this outside the file, or need to change it, 1/5 I don't think we need a constant.
Building app in separate branch. |
@cpoile This is working for me now.
There's only 1 thing to follow-up up on with the screens above ☝️ I do not see this green badge thing |
That's what I get on my Samsung tablet too, so it might be a samsung thing.
It comes from pulling down the top of the screen (to get the Internet, bluetooth, flashlight, dnd buttons). Then pull those buttons down again to expand it, and you might see the running apps bar on the bottom of that expanded screen. (That's on my pixel.) On my Samsung tablet I don't have that, I have the slot in the notifications list (after pulling down the top of the screen once) -- see the second row first column in the screenshots above. |
@cpoile I'm not sure if there's much more needed here. Not getting the green badge on Samsung launcher is a bit unfortunate. Given the relatively small importance compared to the rest of the PR, would it seem reasonable to you if I opened a separate Jira issue for this and it can then be prioritized as appropriate rather then preventing this PR from merging? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and passed based on testing above ☝️
@cpoile I have created a separate Jira here https://mattermost.atlassian.net/browse/MM-54935 for the badge issue so this can logged and investigated based on whatever priority we decide we want to assign.
This PR can now be merged 👍
…ttermost#7585) * Add foreground service for Android; add voip UIBackgroundMode for iOS * remove iOS change for this PR * create foreground notification channel once at startup
Summary
voip
to the list of background modes. This is just a protection, I'm not 100% sure it does anything.Test steps
Screenshots
This is what the user will see now when the app is backgrounded while on a call (and only when on a call):
Ticket Link
Checklist
Device Information
Release Note