Skip to content

Commit be8e49b

Browse files
committed
Freshness pass for java and kotlin
1 parent 0feb50a commit be8e49b

18 files changed

+123
-115
lines changed

articles/ai-services/immersive-reader/includes/quickstarts/immersive-reader-client-library-csharp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Create a new project in Visual Studio, using the ASP.NET Core Web Application te
3535
Right-click on the project in the **Solution Explorer** and choose **Manage User Secrets**. This opens a file called *secrets.json*. This file isn't checked into source control. To learn more, see [Safe storage of app secrets](/aspnet/core/security/app-secrets?tabs=windows). Replace the contents of *secrets.json* with the following, supplying the values given when you created your Immersive Reader resource.
3636

3737
> [!IMPORTANT]
38-
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](/azure/key-vault/general/overview).
38+
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../../key-vault/general/overview.md).
3939
4040
```json
4141
{

articles/ai-services/immersive-reader/includes/quickstarts/immersive-reader-client-library-java-android.md

Lines changed: 86 additions & 82 deletions
Large diffs are not rendered by default.

articles/ai-services/immersive-reader/includes/quickstarts/immersive-reader-client-library-kotlin.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,53 @@ In this quickstart, you build an Android app from scratch and integrate the Imme
1919
* An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/ai-services).
2020
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. Save the output of your session into a text file so you can configure the environment properties.
2121
* [Git](https://git-scm.com).
22-
* [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk).
2322
* [Android Studio](https://developer.android.com/studio).
2423

2524
## Create an Android project
2625

27-
Start a new project in Android Studio. Source code for this example is available as part of the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/quickstart-kotlin).
26+
Start a new project in Android Studio.
2827

29-
![New project - Kotlin](../../media/android/kotlin/android-studio-create-project.png)
28+
:::image type="content" source="../../media/android/kotlin/android-studio-create-project.png" alt-text="Screenshot of the Start new project option in Android Studio.":::
3029

31-
In the **Choose your project** window, select **Empty Activity**, and then select **Next**.
30+
In the **Templates** window, select **Empty Views Activity**, and then select **Next**.
3231

33-
![Empty Activity project - Kotlin](../../media/android/kotlin/android-studio-empty-activity.png)
32+
:::image type="content" source="../../media/android/kotlin/android-studio-empty-activity.png" alt-text="Screenshot of the Templates window in Android Studio.":::
3433

3534
## Configure the project
3635

3736
Name the project **QuickstartKotlin**, and select a location to save it. Select **Kotlin** as the programming language, and then select **Finish**.
3837

39-
![Configure the project - Kotlin](../../media/android/kotlin/android-studio-configure-project.png)
38+
:::image type="content" source="../../media/android/kotlin/android-studio-configure-project.png" alt-text="Screenshot of the Configure project window in Android Studio.":::
4039

4140
## Set up assets and authentication
4241

43-
Create a new **/assets** folder.
42+
Create a new */assets* folder. Right-click on **app** and select **Folder** -> **Assets Folder** from the dropdown.
4443

45-
![Create a new assets folder - Kotlin](../../media/android/kotlin/android-studio-assets-folder.png)
44+
:::image type="content" source="../../media/android/kotlin/android-studio-assets-folder.png" alt-text="Screenshot of the Assets folder option.":::
4645

47-
Create a file named **env** inside the assets folder. Add the following names and values, and supply values as appropriate. Don't commit this env file into source control because it contains secrets that shouldn't be made public.
46+
Right-click on **assets** and select **New** -> **File**. Name the file **env**.
4847

49-
> [!IMPORTANT]
50-
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../../key-vault/general/overview.md).
48+
:::image type="content" source="../../media/android/kotlin/android-studio-create-env-file.png" alt-text="Screenshot of name input field to create the env file.":::
5149

52-
![Create a new env file - Kotlin](../../media/android/kotlin/android-studio-create-env-file.png)
50+
Add the following names and values, and supply values as appropriate. Don't commit this env file into source control because it contains secrets that shouldn't be made public.
5351

5452
```text
5553
TENANT_ID=<YOUR_TENANT_ID>
5654
CLIENT_ID=<YOUR_CLIENT_ID>
5755
CLIENT_SECRET=<YOUR_CLIENT_SECRET>
5856
SUBDOMAIN=<YOUR_SUBDOMAIN>
5957
```
60-
![Environment variables in Android Studio - Kotlin](../../media/android/kotlin/android-studio-assets-and-env-file.png)
58+
59+
:::image type="content" source="../../media/android/kotlin/android-studio-assets-and-env-file.png" alt-text="Screenshot of Environment variables in Android Studio.":::
60+
61+
> [!IMPORTANT]
62+
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../../key-vault/general/overview.md).
6163
6264
## Add dependencies
6365

64-
Replace the existing dependencies in the **build.gradle** file with the following implementations to enable coroutines (asynchronous programming), gson (JSON parsing and serialization), and dotenv to reference the variables defined in the env file. You might need to sync the project again when you implement MainActivity.kt in a later step in this quickstart.
66+
Replace the existing dependencies in the *build.gradle* file with the following implementations to enable coroutines (asynchronous programming), gson (JSON parsing and serialization), and dotenv to reference the variables defined in the env file. You might need to sync the project again when you implement *MainActivity.kt* in a later step in this quickstart.
67+
68+
:::image type="content" source="../../media/android/kotlin/android-studio-build-gradle.png" alt-text="Screenshot of app gradle dependencies.":::
6569

6670
```build.gradle
6771
dependencies {
@@ -80,13 +84,11 @@ dependencies {
8084
}
8185
```
8286

83-
![App Gradle implementations- Kotlin](../../media/android/kotlin/android-studio-build-gradle.png)
84-
8587
## Update app strings and layout resources
8688

87-
Replace the content in **res/strings/strings.xml** with the following strings to be used in the app.
89+
Replace the content in *res/values/strings.xml* with the following strings to be used in the app.
8890

89-
![App strings.xml - Kotlin](../../media/android/kotlin/android-studio-strings.png)
91+
:::image type="content" source="../../media/android/kotlin/android-studio-strings.png" alt-text="Screenshot of the app strings xml file.":::
9092

9193
```strings.xml
9294
<resources>
@@ -102,9 +104,9 @@ Replace the content in **res/strings/strings.xml** with the following strings to
102104
</resources>
103105
```
104106

105-
Replace the content in **res/layout/activity_main.xml** with the following XML to be used in the app. This XML is the UI layout of the app.
107+
Replace the content in *res/layout/activity_main.xml* with the following XML to be used in the app. This XML is the UI layout of the app. If you don't see the code in the *activity_main.xml* file, right-click on the canvas and select **Go to XML**.
106108

107-
![App activity_main.xml - Kotlin](../../media/android/kotlin/android-studio-activity-main-xml.png)
109+
:::image type="content" source="../../media/android/kotlin/android-studio-activity-main-xml.png" alt-text="Screenshot of the app activity mail xml file.":::
108110

109111
```activity_main.xml
110112
<?xml version="1.0" encoding="utf-8"?>
@@ -203,11 +205,11 @@ Replace the content in **res/layout/activity_main.xml** with the following XML t
203205

204206
## Set up the app Kotlin code JavaScript interface
205207

206-
In the **/Java/com.example.quickstartkotlin** folder, create a new Kotlin class and name it **WebAppInterface**. Then add the following code to it. This code enables the app to interface with JavaScript functions in HTML that will be added in a later step.
208+
In the *kotlin+java/com.example.quickstartkotlin/* folder, create a new Kotlin class and name it `WebAppInterface`. Then add the following code to it. This code enables the app to interface with JavaScript functions in HTML that will be added in a later step.
207209

208-
![com.example.quickstartkotlin folder - Kotlin](../../media/android/kotlin/android-studio-com-folder.png)
210+
:::image type="content" source="../../media/android/kotlin/android-studio-com-folder.png" alt-text="Screenshot of the quickstartkotlin folder.":::
209211

210-
![WebAppInterface - Kotlin](../../media/android/kotlin/android-studio-web-app-interface.png)
212+
:::image type="content" source="../../media/android/kotlin/android-studio-web-app-interface.png" alt-text="Screenshot of the WebAppInterface Kotlin class.":::
211213

212214
```WebAppInterface.kt
213215
// Copyright (c) Microsoft Corporation. All rights reserved.
@@ -258,7 +260,7 @@ class WebAppInterface(private val mContext: Context, var parentLayout: LinearLay
258260

259261
## Set up the app Kotlin code Main Activity
260262

261-
In the **/Java/com.example.quickstartkotlin** folder, you'll see an existing **MainActivity.kt** Kotlin class file. This file is where the app logic is authored. Replace its contents with the following code:
263+
In the *kotlin+java/com.example.quickstartkotlin/* folder, there's an existing *MainActivity.kt* Kotlin class file. This file is where the app logic is authored. Replace its contents with the following code.
262264

263265
```MainActivity.kt
264266
// Copyright (c) Microsoft Corporation. All rights reserved.
@@ -515,15 +517,17 @@ class MainActivity : AppCompatActivity() {
515517
}
516518
```
517519

520+
You might need to sync the project again.
521+
518522
## Add the app HTML to the web view
519523

520-
The web view implementation needs HTML to work. Right-click the **/assets** folder, create a new file, and name it **immersiveReader.html**.
524+
The web view implementation needs HTML to work. Right-click the */assets* folder, create a new file, and name it *immersiveReader.html*.
521525

522-
![Create a new HTML file - Kotlin](../../media/android/kotlin/android-studio-immersive-reader-html.png)
526+
:::image type="content" source="../../media/android/kotlin/android-studio-immersive-reader-html.png" alt-text="Screenshot of the name input field for the new html file.":::
523527

524-
![HTML asset location - Kotlin](../../media/android/kotlin/android-studio-immersive-reader-html-assets.png)
528+
:::image type="content" source="../../media/android/kotlin/android-studio-immersive-reader-html-assets.png" alt-text="Screenshot of the html file location in the assets folder.":::
525529

526-
Add the following HTML and JavaScript. This code adds the Immersive Reader SDK to the app and uses it to open the Immersive Reader by using the app code we've written.
530+
Add the following HTML and JavaScript. This code adds the Immersive Reader SDK to the app and uses it to open the Immersive Reader by using the app code we wrote.
527531

528532
```immersiveReader.html
529533
<!-- Copyright (c) Microsoft Corporation. All rights reserved.
@@ -570,9 +574,9 @@ Licensed under the MIT License. -->
570574

571575
## Set up app permissions
572576

573-
![AndroidManifest - Kotlin](../../media/android/kotlin/android-studio-android-manifest-xml.png)
577+
Because the application needs to make network calls to the Immersive Reader SDK to function, we need to ensure the app permissions are configured to allow network access. Replace the content of */manifests/AndroidManifest.xml* with the following XML.
574578

575-
Because the application needs to make network calls to the Immersive Reader SDK to function, we need to ensure the app permissions are configured to allow network access. Replace the content of **/manifests/AndroidManifest.xml** with the following XML:
579+
:::image type="content" source="../../media/android/kotlin/android-studio-android-manifest-xml.png" alt-text="Screenshot of the Android Manifest file.":::
576580

577581
```AndroidManifest.xml
578582
<?xml version="1.0" encoding="utf-8"?>
@@ -604,7 +608,7 @@ Because the application needs to make network calls to the Immersive Reader SDK
604608

605609
Use Android Studio to run the app on a device emulator. When you select **Immersive Reader**, the Immersive Reader opens with the content on the app.
606610

607-
![Immersive Reader - Kotlin](../../media/android/kotlin/android-studio-device-emulator.png)
611+
:::image type="content" source="../../media/android/kotlin/android-studio-device-emulator.png" alt-text="Screenshot of the Immersive Reader app running in the emulator.":::
608612

609613
## Next step
610614

articles/ai-services/immersive-reader/includes/quickstarts/immersive-reader-client-library-nodejs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ npm install axios qs
4949
Create a new file called *.env* in the root of your project. Paste the following code into it, supplying the values given when you created your Immersive Reader resource. Don't include quotation marks or the `{` and `}` characters.
5050

5151
> [!IMPORTANT]
52-
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](/azure/key-vault/general/overview).
52+
> Remember to never post secrets publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../../key-vault/general/overview.md).
5353
5454
```text
5555
TENANT_ID={YOUR_TENANT_ID}
3.23 KB
Loading
-40.4 KB
Loading
-31.3 KB
Loading
-25.5 KB
Loading
-49.5 KB
Loading
-39 KB
Loading

0 commit comments

Comments
 (0)