Open dsilhavy opened 1 year ago
As a starting point / proof of concept, the following flow has been implemented:
http://ms.launch.3gppservices.org
and https://ms.launch.3gppservices.org
: https://dash.fokus.fraunhofer.de/tests/dsi/5gmag/http-handler/Added an <intent-filter>
in the AndroidManifest.xml
of the Media Session Handler:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"/>
<data android:scheme="https"/>
<data android:host="ms.launch.3gppservices.org"/>
</intent-filter>
Short demo video:
As a next step, we can focus on the workflow defined in 5.13.6.2 and 5.13.6.2.3. I suggest adding a new view to the 5GMSd Aware application with a list of service URLs using the format defined in Table 5.13.6.2.2-1. Once a service URL is selected, the Media Session Handler is started and the streaming session begins. Similar to what we are doing today when the user selects an entry from the list of service URLs that are provided via M8. Alternatively we "convert" the entries from our m8.json
to service URLs.
This is very nice Daniel. I agree that it would be excellent if the streaming service is started immediately. Also we need to basically extend further that the service/provisioning id is added in order to connect the Media Session Handler to the AF in a session. I also see that there is the need to accept the handling of the URL by the Media Session Handler. Finally, if the Media Session Handler is not launched, the message will go to the AF, and the AF may provide a redirect directly to the service.
Finally, if the Media Session Handler is not launched, the message will go to the AF, and the AF may provide a redirect directly to the service.
If there is no registered intent for the 3GPP Service URL https://ms.launch.3gppservices.org/, it needn't be the 5GMS AF that handles the fallback case: it could be any endpoint in the 5G System registered with that special domain name.
Finally, if the Media Session Handler is not launched, the message will go to the AF, and the AF may provide a redirect directly to the service.
If there is no registered intent for the 3GPP Service URL ms.launch.3gppservices.org, it needn't be the 5GMS AF that handles the fallback case: it could be any endpoint in the 5G System registered with that special domain name.
Yes, true. But the idea is that this function of URL handling in the network is at least "logically" assigned to the Media AF.
I have to give this another thought with a fresh mind but currently I assume it is more complicated than I orginally thought. In the following I outline the current workflow and the problem I see when launching the Media Session Handler via a deeplink:
sendingUid
that is generated by the Android API. So this is not something we are generating ourself at this point.sendingUid
we maintain an instance of the ClientSessionModel
class. This is saved via a HashMap HashMap<sendingUid, ClientSessionModel>
. The ClientSessionModel
saves sessions relevant information such as the ServiceAccessInformation
. Moreover, we save the instance of the Messenger
class that we can use to send messages to this specific application/Media Stream Handler. For instance, in case of metrics reporting we periodically query metrics from each connected Media Stream Handler.
data class ClientSessionModel(
var messenger: Messenger?,
var serviceAccessInformation: ServiceAccessInformation? = null,
var serviceAccessInformationApi: ServiceAccessInformationApi? = null,
var serviceAccessInformationResponseHeaders: Headers? = null,
var serviceAccessInformationRequestTimer: Timer? = null
)
data class ServiceListEntry(
val provisioningSessionId : String,
val name: String,
val entryPoints: ArrayList<EntryPoint>?
) : Parcelable
ServiceAccessInformation
and provides a list of valid mediaEntryPoints
to the Media Stream Handler via an IPC message. This is a direct response to the previous message from step 7). We know who the sender was, so we can just respond. sendingUid
. mediaEntryPoints
from the Media Session Handler to the Media Stream Handler (see step 9 above). We started the Media Session Handler via a Deeplink that contains all the relevant information about media-entry-point
, af-host-address
URL etc. (see Table 5.13.6.2.2 1). But at this point we don't know to which IPC client/Media Stream Handler we should send the valid mediaEntryPoints
. Even if the IPC connection has been established we might have multiple Media Stream Handlers connected to the same Media Session Handler. How do we trigger the "right" Media Stream Handler? Similar, how do we persist the ServiceAccessInformation
we just received. This has to be mapped to the streaming session of a specific Media Stream Handler.sendingUid
)? That way we can also register new clients, see step 4 above. However, in this case all messages need to be enriched by this new unique identifier.Based on our discussion in the call I checked whether it is possible to provide information back from the Media Session Handler to the entity that triggered the intent.
From what I found, there is no direct way to send a message back to the specific application (e.g. a Chrome tab that launched the intent) from our Android application.
However, there is a workaround as we can launch another intent from our Media Session Handler which then gets picked up by the corresponding application. As an example, based on the previous comment.
private fun handleActionViewIntent(intent: Intent) {
val data = intent.data
if (data != null) {
val message = data.getQueryParameter("message")
if (message != null) {
// Create an intent to send the message back to the Chrome browser
val returnIntent = Intent(Intent.ACTION_VIEW)
returnIntent.data = Uri.parse("https://dash.fokus.fraunhofer.de/tests/dsi/5gmag/http-handler/?message=Hello this is the Media Session Handler")
// Start the intent to send the message back
startActivity(returnIntent)
}
}
}
In this case we call the original URL that started the intent and pass a message via query parameters: message=Hello this is the Media Session Handler
This is more a workaround though, as we don't have information about the app that launched the Media Session Handler originally. We only know the scheme
, the host
and the queryparameters
that are defined in the intent filter, e.g: https://ms.launch.3gppservices.org?message=helloworld
What we can do in addition is specify the orginal URL ("https://dash.fokus.fraunhofer.de/tests/dsi/5gmag/http-handler/") as another query parameter, e.g: https://ms.launch.3gppservices.org?message=helloworld&url=https%3A%2F%2Fdash.fokus.fraunhofer.de%2Ftests%2Fdsi%2F5gmag%2Fhttp-handler%2F
A short demo video:
More background:
I also checked Co Pilot
To achieve this, you can use deep linking to open your Android app from a web page. Deep linking allows you to seamlessly transition users from a website to specific in-app content. Here are the steps to create Android App Links:
Create Intent Filters in Your Manifest:
In your Android app’s AndroidManifest.xml, define intent filters for incoming links. These filters specify how your app should handle URLs associated with your website domain.
The following elements and attributes are needed within your <activity>
tag:
<action>
: Specify the VIEW intent action so that the intent filter can be reached from web link clicks.
<data>
: Include the android:scheme attribute. The data tags represent a URI format that resolves to the activity.
BROWSABLE
category: Required for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser won’t route users to your app.
DEFAULT
category: Allows your app to respond to implicit intents.
Example of an intent filter for deep linking using the URI “https://www.example.com/gizmos”: XML
<activity android:name=".YourActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
</activity>
AI-generated code. Review and use carefully. More info on FAQ.
Configure Your Mobile Website: To ensure the best user experience, configure your mobile website to handle the App Link. This prevents users from viewing a 404 page when they don’t have your app installed. When users click a link associated with your app, they’ll be taken directly to the relevant content within your app. Remember that deep linking can be complex, but using tools like Branch can simplify the process by handling deep links, hosting them, and providing analytics behind clicks and app opens. I recommend exploring such tools to avoid rebuilding everything from scratch1.
This seems to be addressing the question: https://stackoverflow.com/questions/34197933/how-do-you-call-an-android-app-and-get-a-result-back-from-a-web-page-in-chrome
This seems to correspond to what I did in https://github.com/5G-MAG/rt-5gms-media-session-handler/issues/37#issuecomment-1790607670. Basically, the intent filter URL contains a callback URL and possible a custom string that tells the application to trigger another intent with some payload. However, I don't think there is a way to directly respond to the caller that triggered the first intent.
Feature description
3GPP TR 26.804 Section 5.13 deals with announcing media services in a portal application or service list and launching the URL of a media service entry point. The Android operating system allows a URL to be used by one application to launch a specific other application on the same UE by means of Android App Links. Consequently, we can start the Media Session Handler when selecting a media service entry point in the 5GMSd Aware Application.
This issue deals with a proof of concept implementation of the solution defined in Section 5.13.5 and 5.13.6.2.