-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(howto): polish exchange-oob-data page #223
Conversation
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.
Some minor suggestions and one question.
Provide a complete howto guide for the integration of out-of-band v2 feature into the Android application.
84e42dd
to
a2282f0
Compare
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.
LGTM
@morphis will you take another look at this in case something I am missing ? |
@adglkh yes, I wanted to look at this. I will leave comments here next |
@adglkh btw. you can set specific people as reviewer when you want their explicit review before things can be merged. |
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.
We're moving forward but I think we still have to rework this further as there are still too many obstacles in the way to let people have a smooth journey with this how-to.
Next to inline comments a few more:
- We should not talk about the "Anbox WebRTC platform" but about the "Anbox runtime". That's simpler for people to understand.
- In the "Anbox WebRTC platform" it is unclear how that relates to the former "Prepare your web application" section. We should give a clear set of steps on how someone can test that their now changed web application can exchange messages with the Anbox instance over
socat
Overall I think we're too vague and not following a clear sequence in this how-to yet. People should get everything needed to follow the how-to without having to read a lot more sections in our documentation or start writing a lot of code themselves with potentially a lot more obstacles.
A couple of suggestions:
- When we want them to test the Android side, let them use the existing example application we have but instead of just let them install, highlight important parts of the example application. In the end they can either compile the app and do modifications or just use the prebuilt APK to get a head start without a lot work.
- The same applies for the web client. We should show changes necessary relative to the streaming tutorial so we have consistency and allow people to easily follow.
- If we say "Confirm that..." or similar we need to tell them how to do that. Otherwise people will be confused and either don't complete that step or reach out and ask for clarifications.
@@ -23,6 +24,8 @@ The following instructions guide you to exchange OOB data using a specific imple | |||
|
|||
The following instructions will walk you through how to set up data channels and perform data transmission in both directions between an Android application and a WebRTC platform. | |||
|
|||
Before proceeding, ensure that you have set up a web-based streaming client using the Anbox Cloud streaming stack. If you haven't done so, please follow our setup [guide](https://documentation.ubuntu.com/anbox-cloud/en/latest/tutorial/stream-client/). | |||
|
|||
### Prepare your web application |
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.
We should make the code changes below based on top of what the streaming tutorial has as an example so it's simple for people to apply. Currently it's unclear for example where stream.sendData
should be put.
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.
We should also point that out beforehand that we base all example code on top of this.
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.
+1
@@ -159,6 +158,10 @@ public class DataChannelEventReceiver extends BroadcastReceiver { | |||
} | |||
``` | |||
|
|||
```{note} | |||
If an instance is running on Android 14 image, enabling the out-of-band v2 feature requires the Android app to be running in order to receive broadcasts. If the app is in the [cached state](https://developer.android.com/guide/components/activities/process-lifecycle), the system places [context-registered broadcasts in a queue]((https://developer.android.com/develop/background-work/background-tasks/broadcasts#android-14)),meaning the app may not receive broadcasts immediately, as it would when the app is actively running. | |||
``` |
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.
What is needed for a user to do to achieve this? It's not clear to me how I can fix this without having a deep understanding of what Android does / can be influenced
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.
Let me reword this a bit
|
||
To connect the data channel to the Anbox WebRTC data proxy service within an Android container, the Android app must be installed and running as a system app. To do so, proceed with the following steps: | ||
1. Add the attribute `android:sharedUserId="android.uid.system"` into the `<manifest>` tag in the `AndroidManifest.xml` file of your Android app | ||
2. Create an addon to install your APK as a system app through the pre-start hook with the following content: |
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 can't we use a raw instance instead? Adding the need for addons IMHO just makes things complicated here.
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.
That's a good idea.
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.
Hmm, no, we can't. Using the raw instance makes it impossible to run a pre-start hook where the APK is going to be installed as a system app. I suppose what you meant above was to use the application hooks, but that makes no difference to me. The example below already uses the raw instance.
|
||
See [How to install an APK as a system app](https://documentation.ubuntu.com/anbox-cloud/en/latest/howto/port/install-apk-system-app/#howto-install-apk-system-app) for details. | ||
|
||
3. Navigate to the addon directory and add it to AMS: |
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.
If people just blindly follow the above (and they will do) they will fail as the manifest.yaml
is missing, the hook is maybe not executable etc. If we give steps, they should work and include everything needed to succeed
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.
I think that's too much detail for this context. By this point, people should already know how to create an addon and, further, how to install an APK as a system app.
Once the session is active: | ||
|
||
1. Use the web client, which creates a custom data channel `foo` to initiate the WebRTC connection. | ||
2. After the WebRTC connection is established, verify that the Android application receives a notification indicating the availability of the `foo` data channel. |
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.
How do I do this?
|
||
1. Use the web client, which creates a custom data channel `foo` to initiate the WebRTC connection. | ||
2. After the WebRTC connection is established, verify that the Android application receives a notification indicating the availability of the `foo` data channel. | ||
3. Confirm that the Android application can connect to the `foo` data channel created by the web client. |
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.
How do I do that?
1. Use the web client, which creates a custom data channel `foo` to initiate the WebRTC connection. | ||
2. After the WebRTC connection is established, verify that the Android application receives a notification indicating the availability of the `foo` data channel. | ||
3. Confirm that the Android application can connect to the `foo` data channel created by the web client. | ||
4. Send messages from either the Android application or the WebRTC client, and ensure that the messages are successfully sent and and received over the `foo` data channel. |
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.
How do I do that?
|
||
#### Run end-to-end test | ||
|
||
To launch a streamable instance with the addon you created, run: |
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.
Sorry, I know I suggested this earlier but stream-enabled is better instead of streamable (Spellcheck also does not recognise streamable).
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.
Sure, let me change that.
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.
Ah, you've done that. :)
Thanks
Thanks for the detailed review; I missed this yesterday. I understand the concerns about the current documentation's usability. While there is a balance between providing sufficient detail for developers and simplifying the process for those who are new to the concepts, it ultimately depends on the targeted audience. This document assumes that the reader has some background in Android development and WebRTC when hands on this feature integration. If the targeted audience is the developer, they don't want to dive too much details which is something out of the feature itself. That would also answer those questions about https://github.com/android/user-interface-samples/tree/main/DownloadableFonts/ I agree that the learning path for newcomers to this feature is not as friendly as it could be, and a bit challenging too . Regarding the comment, 'Overall, I think we're too vague and not following a clear sequence in this how-to yet,' I would suggest following the approach used by Android and providing a complete step-by-step how-to guide that walks the reader through the process to achieve the goal instead of linking a different source(E.g. stream client and modify by themselves) and pieced them together as a final technical doc. Create your first Android app When we want them to test the Android side, let them use the existing example application we have but instead of just let them install, highlight important parts of the example application. In the end they can either compile the app and do modifications or just use the prebuilt APK to get a head start without a lot work. |
@adglkh I can have a working meeting with you early next week to figure this out. We can create a single how-to guide not assuming any knowledge from the user, but if that would be too much detail for an expert audience, we could also create two sections with clear delineation of what applies to whom. (Also, sorry that I assumed the technical review part of it and merged this early. So we have to open another PR for the changes Simon has suggested. I will ensure one doc reviewer and one tech reviewer approval from going forward.) |
A: yes, let's meet up next week for this. I can resolve all of the existing review comments that Simon left above as most of them makes sense to me. |
Polish the out-of-band-v2 chapter and to resolve the comments in the canonical#223 PR
Polish the out-of-band-v2 chapter and to resolve the comments in the canonical#223 PR
Polish the out-of-band-v2 chapter and to resolve the comments in the canonical#223 PR
Polish the out-of-band-v2 chapter and to resolve the comments in the canonical#223 PR
Provide a complete howto guide for the integration of out-of-band v2
feature into the Android application.