You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In new android we have to request media projection before starting foreground service, which unconditionally involves interaction with user (it's not granted permanently like with permissions).
It complicates starting sender/receiver from notification and tile: if the app is closed, we don't have an activity, and can't just request projection. We'd need to create an activity first, either temporary or our main activity, then tell it to do the job. But that would contradict the purpose of notification and tile to be able to control streaming without opening the app.
Another problem is architectural rather than technical. If we want to start streaming from kotlin, we either need to replicate android_backend.dart in kotlin (and have a mirror of config in kotlin, and to handle races, and to maintain two copies of the big chunk of code, etc. etc.), or we need communicate from headless android service with dart code (and have multiple dart entry points and multiple root apps). Both approaches are feasible but are rather complicated and tricky. It would be nice to stick with something simpler.
Suggested solution
To deal with this new requirements, we can switch from 2 states (STARTED and STOPPED) to 3 states:
STARTED - projection acquired, streaming active
PAUSED - projection acquired, streaming inactive
STOPPED - projection released, streaming inactive
If you pause streaming instead of stopping it, you can start it again without any permission dialogs. It means that if streaming is paused, we can resume it from notification and tile.
We'll need to rework UI for these new approach:
In app, instead of START/STOP buttons, we'll have:
Three buttons shared between sender and receiver: START, PAUSE, STOP. (We can combine the first two into one button).
ON/OFF switch in sender and in receiver. It's not a button that starts sender or receiver, it's a flag that control whether sender or receiver should be started when START is pressed.
In notification, we'll have:
One or two buttons, depending on current state:
If streaming is STARTED, then "Pause streaming" and "Stop streaming" buttons.
If streaming is PAUSED, then "Start streaming" and "Stop streaming" buttons.
If streaming is STOPPED, then "Open app" button. This button will appear only if user did a full stop instead of a pause.
On tapping notification, the app is opened.
On swiping away notification, streaming is STOPPED.
In tile:
When switched on:
If streaming is PAUSED, START streaming.
If streaming is STOPPED, open the app. This will happen only if user did a full stop instead of a pause.
I think if we decide to do it, it should be out of scope of #94, but before proceeding with roc cast. (Actually I think roc cast should use same approach, so this can be the first step towards it).
Problem
In new android we have to request media projection before starting foreground service, which unconditionally involves interaction with user (it's not granted permanently like with permissions).
It complicates starting sender/receiver from notification and tile: if the app is closed, we don't have an activity, and can't just request projection. We'd need to create an activity first, either temporary or our main activity, then tell it to do the job. But that would contradict the purpose of notification and tile to be able to control streaming without opening the app.
Another problem is architectural rather than technical. If we want to start streaming from kotlin, we either need to replicate android_backend.dart in kotlin (and have a mirror of config in kotlin, and to handle races, and to maintain two copies of the big chunk of code, etc. etc.), or we need communicate from headless android service with dart code (and have multiple dart entry points and multiple root apps). Both approaches are feasible but are rather complicated and tricky. It would be nice to stick with something simpler.
Suggested solution
To deal with this new requirements, we can switch from 2 states (STARTED and STOPPED) to 3 states:
If you pause streaming instead of stopping it, you can start it again without any permission dialogs. It means that if streaming is paused, we can resume it from notification and tile.
We'll need to rework UI for these new approach:
In app, instead of START/STOP buttons, we'll have:
Three buttons shared between sender and receiver: START, PAUSE, STOP. (We can combine the first two into one button).
ON/OFF switch in sender and in receiver. It's not a button that starts sender or receiver, it's a flag that control whether sender or receiver should be started when START is pressed.
In notification, we'll have:
One or two buttons, depending on current state:
On tapping notification, the app is opened.
On swiping away notification, streaming is STOPPED.
In tile:
The app UI could be updated like follows:
i.e.:
Steps
The text was updated successfully, but these errors were encountered: