Azure-Samples / communication-services-android-calling-hero

Hero Sample for Android Calling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

page_type languages products
sample
java
azure
azure-communication-services
azure-communication-ui-calling

Group Calling Sample

The sample is a native Android application that uses the Azure Communication Services Android UI client library to build a calling experience that features both voice and video calling. The application uses a server-side component to provision access tokens that are then used to initialize the Azure Communication Services client library. To configure this server-side component, feel free to follow the Trusted Service with Azure Functions tutorial.

Additional documentation for this sample can be found on Microsoft Docs. See this sample's wiki to see updated information on known issues

Features

  • Start a new group call
  • Join an existing group call
  • Join an existing Teams Meeting (For instructions: Teams Tenant Interoperability)
  • Render remote participant video streams dynamically
  • Switch layout between different call cases: only-local video view, one-on-one call view and group call with multiple participants
  • Turning local video stream from camera on/off
  • Mute/unmute local microphone audio
  • call on hold

Prerequisites

Before running the sample for the first time

  1. Open Android Studio and select Open an Existing Project.
  2. Select folder AzureCalling.
  3. Expand app/assets to update appSettings.properties. Set the value for the key communicationTokenFetchUrl to be the URL for your Authentication Endpoint.

Run Sample

  1. Build/Run in Android Studio

Securing Authentication Endpoint

For simple demonstration purposes, this sample uses a publicly accessible endpoint by default to fetch an Azure Communication token. For production scenarios, it is recommended that the Azure Communication token is returned from a secured endpoint.

With additional configuration, this sample also supports connecting to an Azure Active Directory (AAD) protected endpoint so that user login is required for the app to fetch an Azure Communication Services access token. See steps below:

  1. Enable Azure Active Directory authentication in your app.

  2. Go to your registered app overview page under Azure Active Directory App Registrations. Take note of the Package name, Signature hash, MSAL Configutaion Azure Active Directory Configuration

  3. Edit AzureCalling/app/src/main/assets/appSettings.properties and set isAADAuthEnabled to enable Azure Active Directory

  4. Edit AndroidManifest.xml and set android:path to keystore signature hash. (Optional. The current value uses hash from bundled debug.keystore. If different keystore is used, this must be updated.)

    <activity android:name="com.microsoft.identity.client.BrowserTabActivity">
             <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:host="com.azure.samples.communication.calling"
                     android:path="/Signature hash" <!-- do not remove /. The current hash in AndroidManifest.xml is for debug.keystore. -->
                     android:scheme="msauth" />
             </intent-filter>
         </activity>
  5. Copy MSAL Android configuration from Azure portal and paste to AzureCalling/app/src/main/res/raw/auth_config_single_account.json. Include "account_mode" : "SINGLE"

       {
          "client_id": "",
          "authorization_user_agent": "DEFAULT",
          "redirect_uri": "",
          "account_mode" : "SINGLE",
          "authorities": [
             {
                "type": "AAD",
                "audience": {
                "type": "AzureADMyOrg",
                "tenant_id": ""
                }
             }
          ]
       }
  6. Edit AzureCalling/app/src/main/assets/appSettings.properties and set the value for the key communicationTokenFetchUrl to be the URL for your secure Authentication Endpoint.

  7. Edit AzureCalling/app/src/main/assets/appSettings.properties and set the value for the key aadScopes from Azure Active Directory Expose an API scopes.

  8. Set value for graphURL in AzureCalling/app/assets/appSettings.properties as the Graph API endpoint to fetch user information.

  9. Edit AzureCalling/app/src/main/assets/appSettings.properties and set the value for the key tenant to enable silent login so that the user does not have to be authenticate again and again while restarting the application.

Additional Reading

Known Issues

Please refer to the wiki for known issues related to this sample.

About

Hero Sample for Android Calling

License:MIT License


Languages

Language:Java 100.0%