├── .github
├── CODEOWNERS
├── CODE_OF_CONDUCT.md
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── AzureCalling
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── checkstyle.gradle
│ ├── checkstyle
│ │ └── checkstyle.xml
│ ├── debug.keystore
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ └── appSettings.properties
│ │ ├── colors.xml
│ │ ├── ic_launcher-playstore.png
│ │ ├── java
│ │ └── com
│ │ │ └── azure
│ │ │ └── samples
│ │ │ └── communication
│ │ │ └── calling
│ │ │ ├── AzureCalling.java
│ │ │ ├── contracts
│ │ │ ├── Constants.java
│ │ │ └── SampleErrorMessages.java
│ │ │ ├── externals
│ │ │ ├── authentication
│ │ │ │ ├── AADAuthHandler.java
│ │ │ │ ├── AuthenticationToken.java
│ │ │ │ └── UserProfile.java
│ │ │ └── calling
│ │ │ │ ├── CallingContext.java
│ │ │ │ └── TokenService.java
│ │ │ ├── utilities
│ │ │ ├── AppSettings.java
│ │ │ └── MSGraphRequestWrapper.java
│ │ │ └── views
│ │ │ ├── activities
│ │ │ ├── IntroViewActivity.java
│ │ │ ├── InvitationActivity.java
│ │ │ ├── JoinCallActivity.java
│ │ │ ├── SignInActivity.java
│ │ │ └── StartCallActivity.java
│ │ │ ├── components
│ │ │ └── ErrorInfoBar.java
│ │ │ └── fragments
│ │ │ ├── AbstractBaseFragment.java
│ │ │ ├── GroupMeetingFragment.java
│ │ │ └── TeamsMeetingFragment.java
│ │ └── res
│ │ ├── color-night
│ │ ├── button_filled.xml
│ │ ├── default_icon_tint.xml
│ │ ├── selector_button_filled_text.xml
│ │ ├── selector_button_outlined.xml
│ │ └── selector_button_outlined_text.xml
│ │ ├── color
│ │ ├── button_filled.xml
│ │ ├── default_icon_tint.xml
│ │ ├── selector_button_filled_text.xml
│ │ ├── selector_button_outlined.xml
│ │ ├── selector_button_outlined_text.xml
│ │ ├── selector_primary.xml
│ │ └── selector_secondary.xml
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── bordered_button_background.xml
│ │ ├── button_background.xml
│ │ ├── button_filled.xml
│ │ ├── ic_acs_vector.xml
│ │ ├── ic_display_name.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_shape.xml
│ │ ├── ic_teams_link.xml
│ │ ├── layout_background.xml
│ │ ├── rounded_corners.xml
│ │ ├── selected_tab_left.xml
│ │ ├── snackbar_background.xml
│ │ ├── tab_background_normal.xml
│ │ ├── tab_background_normal_blue.xml
│ │ └── tabview_background.xml
│ │ ├── layout
│ │ ├── activity_intro_view.xml
│ │ ├── activity_invitation.xml
│ │ ├── activity_join_call.xml
│ │ ├── activity_signin.xml
│ │ ├── activity_start_call.xml
│ │ ├── fragment_group_meeting.xml
│ │ ├── fragment_teams_meeting.xml
│ │ ├── landing_layout.xml
│ │ └── view_intro_actionbar.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── raw
│ │ └── auth_config_single_account.json
│ │ ├── values-night
│ │ ├── colors.xml
│ │ └── themes.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ └── data_extraction_rules.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── SCC-SPOOL-CallingSample-Android-PR-YMLyml.yml
└── docs
└── images
├── aadOverview.png
├── androidConfigurationImage.png
├── intro-page-android.png
└── landing-page-android.png
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # These owners will be the default owners for everything in
2 | # the repo. Unless a later match takes precedence
3 | * @Azure-Samples/acs-ui-android-reviewer-1 @Azure-Samples/acs-ui-android-reviewer-2 @Azure-Samples/acs-ui-android-reviewer-3
4 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Microsoft Open Source Code of Conduct
2 |
3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4 |
5 | Resources:
6 |
7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
10 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
4 | > Please provide us with the following information:
5 | > ---------------------------------------------------------------
6 |
7 | ### This issue is for a: (mark with an `x`)
8 | ```
9 | - [ ] bug report -> please search issues before submitting
10 | - [ ] feature request
11 | - [ ] documentation issue or request
12 | - [ ] regression (a behavior that used to work and stopped in a new release)
13 | ```
14 |
15 | ### Minimal steps to reproduce
16 | >
17 |
18 | ### Any log messages given by the failure
19 | >
20 |
21 | ### Expected/desired behavior
22 | >
23 |
24 | ### OS and Version?
25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
26 |
27 | ### Versions
28 | >
29 |
30 | ### Mention any other details that might be useful
31 |
32 | > ---------------------------------------------------------------
33 | > Thanks! We'll be in touch soon.
34 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Purpose
2 |
3 | * ...
4 |
5 | ## Does this introduce a breaking change?
6 |
7 | ```
8 | [ ] Yes
9 | [ ] No
10 | ```
11 |
12 | ## Pull Request Type
13 | What kind of change does this Pull Request introduce?
14 |
15 |
16 | ```
17 | [ ] Bugfix
18 | [ ] Feature
19 | [ ] Code style update (formatting, local variables)
20 | [ ] Refactoring (no functional changes, no api changes)
21 | [ ] Documentation content changes
22 | [ ] Other... Please describe:
23 | ```
24 |
25 | ## How to Test
26 | * Get the code
27 |
28 | ```
29 | git clone [repo-address]
30 | cd [repo-name]
31 | git checkout [branch-name]
32 | npm install
33 | ```
34 |
35 | * Test the code
36 |
37 | ```
38 | ```
39 |
40 | ## What to Check
41 | Verify that the following are valid
42 | * ...
43 |
44 | ## Other Information
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | **/release/*
19 |
20 | # Gradle files
21 | **/.gradle/*
22 | build/
23 |
24 | # DS_Store files
25 | *.DS_Store
26 |
27 | # Local configuration file (sdk path, etc)
28 | local.properties
29 | appSettings.properties
30 |
31 | # Proguard folder generated by Eclipse
32 | proguard/
33 |
34 | # Log Files
35 | *.log
36 |
37 | # Android Studio Navigation editor temp files
38 | .navigation/
39 |
40 | # Android Studio captures folder
41 | captures/
42 |
43 | # IntelliJ
44 | *.iml
45 | **/.idea/*
46 |
47 | # Keystore files
48 | # Uncomment the following lines if you do not want to check your keystore files in.
49 | #*.jks
50 | #*.keystore
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 | .cxx/
55 |
56 | # Google Services (e.g. APIs or Firebase)
57 | # google-services.json
58 |
59 | # Freeline
60 | freeline.py
61 | freeline/
62 | freeline_project_description.json
63 |
64 | # fastlane
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots
68 | fastlane/test_output
69 | fastlane/readme.md
70 |
71 | # Version control
72 | vcs.xml
73 |
74 | # lint
75 | lint/intermediates/
76 | lint/generated/
77 | lint/outputs/
78 | lint/tmp/
79 | # lint/reports/
80 |
--------------------------------------------------------------------------------
/AzureCalling/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/AzureCalling/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdk 34
7 |
8 | defaultConfig {
9 | applicationId "com.azure.samples.communication.calling"
10 | minSdk 26
11 | targetSdk 34
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15 | }
16 |
17 | signingConfigs {
18 | debug {
19 | storeFile file('debug.keystore')
20 | storePassword "android"
21 | keyAlias "androiddebugkey"
22 | keyPassword "android"
23 | }
24 | release {
25 | storeFile file(String.valueOf(System.getenv("KEYSTORE_FILEPATH")))
26 | storePassword System.getenv("KEYSTORE_PASSWORD")
27 | keyAlias System.getenv("KEY_ALIAS")
28 | keyPassword System.getenv("KEY_PASSWORD")
29 | }
30 | }
31 |
32 | buildTypes {
33 | release {
34 | minifyEnabled false
35 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
36 | }
37 | }
38 | compileOptions {
39 | sourceCompatibility JavaVersion.VERSION_1_8
40 | targetCompatibility JavaVersion.VERSION_1_8
41 | }
42 |
43 | packagingOptions {
44 | pickFirst 'META-INF/*'
45 | exclude 'META-INF/DEPENDENCIES'
46 | exclude 'META-INF/LICENSE'
47 | exclude 'META-INF/LICENSE.txt'
48 | exclude 'META-INF/LICENSE.md'
49 | exclude 'META-INF/license.txt'
50 | exclude 'META-INF/NOTICE'
51 | exclude 'META-INF/NOTICE.txt'
52 | exclude 'META-INF/NOTICE.md'
53 | exclude 'META-INF/notice.txt'
54 | exclude 'META-INF/ASL2.0'
55 | exclude 'META-INF/INDEX.LIST'
56 | exclude 'META-INF/jersey-module-version'
57 | }
58 | }
59 |
60 | dependencies {
61 |
62 | implementation 'androidx.appcompat:appcompat:1.6.1'
63 | implementation 'com.google.android.material:material:1.9.0'
64 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
65 | implementation 'com.azure.android:azure-communication-ui-calling:1.6.0'
66 | implementation 'com.microsoft.identity.client:msal:4.7.0'
67 | implementation 'com.microsoft.fluentui:FluentUIAndroid:0.1.35'
68 | implementation 'com.android.volley:volley:1.2.1'
69 | }
70 |
--------------------------------------------------------------------------------
/AzureCalling/app/checkstyle.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'checkstyle'
2 |
3 | checkstyle {
4 | description 'Check codeing standards'
5 | configFile file('checkstyle/checkstyle.xml')
6 | }
7 |
8 | task checkstyle(type: Checkstyle) {
9 | source 'src'
10 | include '**/*.java'
11 | exclude '**/gen/**'
12 | exclude '**/R.java'
13 | exclude '**/BuildConfig.java'
14 | classpath = files()
15 | }
--------------------------------------------------------------------------------
/AzureCalling/app/checkstyle/checkstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
83 |
84 |
85 |
86 |
87 |
88 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
136 |
137 |
138 |
139 |
140 |
142 |
143 |
144 |
145 |
146 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
166 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
194 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
269 |
270 |
271 |
272 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
--------------------------------------------------------------------------------
/AzureCalling/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/communication-services-android-calling-hero/ac20a503121b573b4ddc2222ef6fd5d003208b0e/AzureCalling/app/debug.keystore
--------------------------------------------------------------------------------
/AzureCalling/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
17 |
22 |
25 |
26 |
30 |
33 |
34 |
38 |
41 |
42 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
57 |
58 |
60 |
61 |
62 |
63 |
64 |
65 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/assets/appSettings.properties:
--------------------------------------------------------------------------------
1 | # the address of the azure function used for access token generation
2 | communicationTokenFetchUrl=
3 |
4 | # to turn on Azure Active Directory authentication. (true/false)
5 | isAADAuthEnabled=false
6 |
7 | # multiple scopes can be entered as scopes = a,b,c (no space after ,)
8 | aadScopes=
9 |
10 | # Microsoft Graph API endpoint
11 | graphURL=
12 |
13 | # The tenant-id of Azure Active Directory (Optional)
14 | tenant=
15 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
11 | @android:color/white
12 | @android:color/white
13 | @color/grey400
14 | #0078D4
15 | #C7E0F4
16 | @color/grey950
17 | @color/grey700
18 | @color/grey500
19 | @color/grey300
20 | @android:color/white
21 | @color/grey900
22 | #F9D9D9
23 | #A52121
24 |
25 | @android:color/black
26 | @android:color/white
27 | #E1E1E1
28 |
29 | @android:color/white
30 | @android:color/black
31 |
32 | #FF141414
33 | #212121
34 | #FF303030
35 | #FF6E6E6E
36 | #FF919191
37 | #FFACACAC
38 | #D9303030
39 | #FFF1F1F1
40 | #605E5C
41 |
42 | @android:color/black
43 | @android:color/white
44 |
45 | #0063B1
46 | #F1F1F1
47 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/communication-services-android-calling-hero/ac20a503121b573b4ddc2222ef6fd5d003208b0e/AzureCalling/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/java/com/azure/samples/communication/calling/AzureCalling.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | package com.azure.samples.communication.calling;
5 |
6 | import android.app.Application;
7 | import com.azure.samples.communication.calling.externals.authentication.AADAuthHandler;
8 | import com.azure.samples.communication.calling.utilities.AppSettings;
9 | import com.azure.samples.communication.calling.externals.calling.CallingContext;
10 | import com.azure.samples.communication.calling.externals.calling.TokenService;
11 |
12 | public class AzureCalling extends Application {
13 |
14 | public static final String IN_CALL_CHANNEL_ID = "IN_CALL";
15 |
16 | private AppSettings appSettings;
17 | private CallingContext callingContext;
18 | private AADAuthHandler aadAuthHandler;
19 | private TokenService tokenService;
20 |
21 | @Override
22 | public void onCreate() {
23 | super.onCreate();
24 |
25 | initializeDependencies();
26 | }
27 |
28 | private void initializeDependencies() {
29 | this.appSettings = new AppSettings(getApplicationContext());
30 | final String tokenGenerationAddress = appSettings.getCommunicationToken();
31 | this.aadAuthHandler = new AADAuthHandler(appSettings);
32 | this.tokenService = new TokenService(
33 | getApplicationContext(), tokenGenerationAddress, () -> aadAuthHandler.getAccessToken());
34 | }
35 |
36 | public void createCallingContext() {
37 | this.callingContext = new CallingContext(getApplicationContext(),
38 | () -> tokenService.getCommunicationTokenAsync().get());
39 | }
40 |
41 | public CallingContext getCallingContext() {
42 | return this.callingContext;
43 | }
44 |
45 | public AADAuthHandler getAadAuthHandler() {
46 | return aadAuthHandler;
47 | }
48 |
49 | public AppSettings getAppSettings() {
50 | return appSettings;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/java/com/azure/samples/communication/calling/contracts/Constants.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | package com.azure.samples.communication.calling.contracts;
5 |
6 | public class Constants {
7 | public static final String ACS_SHARED_PREF = "ACS_SHARED_PREF";
8 | public static final String ACS_GROUPCALL_ID = "ACS_GROUPCALL_ID";
9 | public static final String ACS_MEETING_LINK = "ACS_MEETING_LINK";
10 |
11 | public static final String IS_LOGGED_IN = "IS_LOGGED_IN";
12 |
13 | public static final String DISPLAY_NAME = "displayName";
14 | public static final String USERNAME = "username";
15 | public static final String GIVEN_NAME = "givenName";
16 | public static final String ID = "id";
17 |
18 | public static final String START_CALL = "Start a call";
19 | public static final String JOIN_CALL = "Join";
20 | public static final String INVITE_ANOTHER_DEVICE = "Invite another device?";
21 | }
22 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/java/com/azure/samples/communication/calling/contracts/SampleErrorMessages.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | package com.azure.samples.communication.calling.contracts;
5 |
6 | public class SampleErrorMessages {
7 | public static final String GROUP_ID_REQUIRED = "Group call ID is required";
8 | public static final String GROUP_ID_INVALID = "Group call ID is not valid";
9 | public static final String DISPLAY_NAME_REQUIRED = "Display Name is required";
10 | public static final String TEAMS_LINK_REQUIRED = "Teams Link is required";
11 | public static final String TEAMS_LINK_INVALID = "Teams Link is not valid";
12 | public static final String CALL_COMPOSITE_JOIN_CALL_FAILED = "Could not join call";
13 | public static final String CALL_COMPOSITE_END_CALL_FAILED = "Could not end call";
14 | public static final String CALL_COMPOSITE_TOKEN_EXPIRED = "ACS Token has expired";
15 | public static final String USER_LOGIN_CANCEL = "User cancelled login";
16 | }
17 |
--------------------------------------------------------------------------------
/AzureCalling/app/src/main/java/com/azure/samples/communication/calling/externals/authentication/AADAuthHandler.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | package com.azure.samples.communication.calling.externals.authentication;
5 |
6 | import static com.azure.samples.communication.calling.contracts.Constants.DISPLAY_NAME;
7 | import static com.azure.samples.communication.calling.contracts.Constants.GIVEN_NAME;
8 | import static com.azure.samples.communication.calling.contracts.Constants.ID;
9 | import static com.azure.samples.communication.calling.contracts.SampleErrorMessages.USER_LOGIN_CANCEL;
10 |
11 | import android.app.Activity;
12 | import android.os.Build;
13 | import android.util.Log;
14 | import androidx.annotation.NonNull;
15 | import androidx.annotation.Nullable;
16 | import androidx.annotation.RequiresApi;
17 | import com.android.volley.Response;
18 | import com.android.volley.VolleyError;
19 | import com.azure.samples.communication.calling.R;
20 | import com.azure.samples.communication.calling.utilities.AppSettings;
21 | import com.azure.samples.communication.calling.utilities.MSGraphRequestWrapper;
22 | import com.microsoft.identity.client.AcquireTokenSilentParameters;
23 | import com.microsoft.identity.client.AuthenticationCallback;
24 | import com.microsoft.identity.client.AzureCloudInstance;
25 | import com.microsoft.identity.client.IAccount;
26 | import com.microsoft.identity.client.IAuthenticationResult;
27 | import com.microsoft.identity.client.IPublicClientApplication;
28 | import com.microsoft.identity.client.ISingleAccountPublicClientApplication;
29 | import com.microsoft.identity.client.PublicClientApplication;
30 | import com.microsoft.identity.client.SilentAuthenticationCallback;
31 | import com.microsoft.identity.client.exception.MsalException;
32 |
33 | import org.json.JSONException;
34 | import org.json.JSONObject;
35 |
36 | import java.util.Arrays;
37 | import java.util.function.Consumer;
38 |
39 | public class AADAuthHandler {
40 |
41 | private static final String LOG_TAG = AADAuthHandler.class.getSimpleName();
42 |
43 | private final AppSettings appSettings;
44 | private ISingleAccountPublicClientApplication mSingleAccountApp;
45 | private String accessToken = null;
46 |
47 | public AADAuthHandler(final AppSettings appSettings) {
48 | this.appSettings = appSettings;
49 | }
50 |
51 | public void signIn(final Activity activity, final Consumer