The JWT Token has the following claims: channelId and userId , and the claim names iat issued at time , and exp expiration time. This must be a number that represents the seconds that have elapsed since the UNIX epoch. We recommend setting the expiration time to at least 30 minutes after the issued at time iat. The actual tokens are signed by channel's Secret Key.
Choose Users. Click Add Channel and then Oracle Android as the channel type. Complete the dialog: Enter the channel name. For authenticated connections: Switch on the Client Authentication Enabled toggle to determine whether the SDK is connecting to a client authentication-enabled channel. In the Max. For unauthenticated connections: Switch off Client Authentication Enable toggle.
Set the Session expiration time. Click Create. Keep these close at hand. Route the channel to your skill or digital assistant. Switch Channel Enabled to On. AAR Package and then click Next. Navigate to, and select, com. Click Finish. Repeat these steps to import com. Note: You don't need to import this package if you're using the SDK in headless mode. If you're connecting to a channel with client authentication disabled, pass false as the second parameter to the BotsConfiguration.
BotsConfigurationBuilder constructor function. Application; import oracle. Bots; import oracle. BotsCallback; import oracle. BotsConfiguration; import oracle. The class should implement the AuthenticationTokenProvider interface, which then overrides the getAuthToken function to generate and return a JWT token.
The function will be used by the SDK to generate a new token whenever it needs to establish a new connection and existing token is expired. The code would look something like this: import android. AuthenticationTokenProvider; import oracle. Display the user interface: import oracle. App Development. This value gets initialized by the SDK if not provided. No A randomly generated value authTokenProvider An instance of AuthenticationTokenProvider , which is used to generate a new token whenever the SDK needs to establish a new connection using a client authentication-enabled channel and when existing token is expired.
Feature Flags Property Description Required? Default Value disablePastActions A field for disabling the button clicks on the messages that a user has already interacted with.
The allowed values are all , none , and postback. The behavior enabled by this property is independent of the digital assistant-level configuration for disabling the selection of past actions. You need to set the two separately. No all displayPreviousMessages Enables or disables the display of previous messages after the SDK has been re-initialized. When set to false , the previous messages are not displayed for the user after re-initialization of SDK.
No true enableAttachment Enables attachment sharing in the chat view. When set to true , you can restrict items that are available in the share menu popup using shareMenuItems. No true enableAttachmentSecurity When set to true , extra headers are passed to the attachment upload requests to ensure that they can't be downloaded without passing a valid signed JWT token as an authorization header.
No false enableClearMessage Enables the clear message button in the header of the chat view. No false enableNotification Enables or disables new message notifications from the SDK when the chat application is running in the background. The SDK won't provide any notifications when you set this flag to false. No true enableNotificationSound Enables the notification sound on new skill messages while the chat view is open. This feature only applies when enableNotificationSoundSetting is set to false.
No true enableNotificationSoundSetting Enables the notification sound setting button in the chat view header. No false enableSpeechRecognition Enables the speech recognition service to convert user voice to text messages. Set this property to true to use the enableSpeechRecognitionAutoSend property. No false enableSpeechRecognitionAutoSend When enableSpeechRecognitionAutoSend is set to true the default , the user's speech response is automatically sent to the chat server and displays as a sent message in the chat window.
When set to false , the user's speech response is rendered in the message text field before it's sent to the chat server so that the user can modify it before sending it manually, or delete the message.
No true enableSpeechSynthesis Enables the skill's audio response button in the header of the chat view. When the button is in the unmute state, the skill's responses are read aloud. No false enableTimestamp Enables the timestamp for messages.
By default, it is set to true , where the button is muted. No true initUserHiddenMessage A user text message that's used to initiate a conversation.
This message, which is sent when chat view is ready, does not actually display in the chat. The profile payload must be of type User. The profile is updated before sending the value in initUserHiddenMessage.
No WebviewLinkHandlerType. Multi-Lingual Chat describes how create this menu. To use this flag, you must set enableAttachment to true. No false showConnectionStatus Enables the connection status to display in the chat view header.
No true speechLocale The expected locale of the user's speech that's used for voice recognition. Call the Bots. Voice recognition will not work if an unsupported locale has been passed. Applicable only if enableSpeechSynthesis is set to true.
If the device does not support the preferred voice, then the default voice for the preferred language is used instead. When neither the preferred voice or language are supported, then the default voice and language are used. If the subtitle flag is set and either or both the showConnectionStatus , showTypingIndicator are set to true , then the subtitle is displayed instead of either the connection status or the typing indicator.
It can accept a string of format tokens like 'mm:ss:a'. No 20 WebViewConfig Sets the attributes of the in-widget webview, such as its size partial or full or customizations to the clear button. Customisations to clear button inside the webview can also be done.
No Sets the configuration settings for of the webview. Custom Colors You can modify the chat view's colors to give it a custom look. For implementations created using versions prior to Custom Text You can customize the default text displayed in the chat view by modifying the following strings.
The other string resources maintain their default values. This resource is used only when the title feature flag is not set. If no customizations have been provided, then by default, the clicked images are saved inside the Camera folder of DCIM. Also, the content description for the attachment button. Also, the content description for the mute button of the audio response.
Also, the content description for the unmute button of the audio response. Also, the content description for back button. Also, the content description for the keyboard button. Also, the content description for the clear button. Also, the content description for the download button. Also, the content description for the mute button of the notification sound.
Also, the content description for the unmute button of the notification sound. Also, the content description for the send button. Also, the content description for the microphone button. Error in loading location preview image. Tap to reload image. This string appears only when enableTimestamp is set to true. Clear messages? Error in capturing photo. Error in recording audio. Please try again later. Speech Recognition Error. The set speech locale is not supported. Can not start recording.
Uploading file to server It's spoken by screen readers before the skill response. The text is not displayed in the chat view. This property is deprecated in Release From that release onward, the setting for this property will be ignored. It's spoken by screen readers before user messages.
Too much voice input to recognize. Can not generate recognized text. Could not detect the voice, no message sent. Please Wait Page is Loading. This icon displays in notifications only when the showBotAvatar feature flag is set to true. This icon displays on notifications only when the showBotAvatar feature flag is set to true. Use these constructors: BotsConfiguration. This cannot be null. Parameters: application — The application instance. The SDK initializes this value when it's not provided.
An instance of this interface can be passed to the authTokenProvider property to allow the SDK to generate a new authentication token when one is required to establish an authenticated channel connection. When implementing this interface, override the public String getAuthToken method. Interface BotsCallback This interface acts as a callback while initializing the library. Show Conversation Activity After initializing the SDK, display the conversation view by invoking public static void show Context context.
This method's context parameter is the context from which to start the activity. Customize Notifications You can customize the notifications received for the skill's messages by instantiating the NotificationCustomizer class and passing the instance to the notificationCustomizer property. The constructors are: NotificationCustomizer — Initializes the notification channel with the default configuration.
The channelId parameter is the ID of the notification channel through which the notifications are sent. NotificationCustomizer String channelId, String channelName, String description, String title — Initializes the notification channel with the given parameters: channelID — The ID of the notification channel through which notifications are sent. Absolute and Relative Timestamps You can enable absolute or relative timestamps for chat messages.
Configure Relative Timestamps To add a relative timestamp: Enable timestamps — enableTimestamp: true Enable relative timestamps — timestampType: 'relative' When you configure the timestamp timestampType: 'relative' , an absolute timestamp displays before the first message of the day as a header. This header displays when the conversation has not been cleared and older messages are still available in the history. This timestamp is updated at following regular intervals seconds, minutes, etc.
For first 10s Between 10ss Every minute between 1mm Every hour between 1hrhr Every day between 1dd Every month between 1mm Every year after first year When a new message is loaded into the chat, the relative timestamp on the previous message is removed and a new timestamp appears on the new message displaying the time relative to the previous message.
At that point, the relative timestamp updates until the next messages arrives. Display the Conversation History You can either enable or display of a user's local conversation histor after the SDK has been re-initialized by setting displayPreviousMessages to true or false in the bots configuration. Delegation The delegation feature lets you set a delegate to receive callbacks before certain events in the conversation.
To set a delegate, a class must implement the interface MessageModifierDelegate and pass its instance to the messageModifierDelegate property.
Its text parameter is the text message. EventListener To listen for the connection status change, the message sent to the skill and received from the skill, and the attachment upload status events, a class should implement the EventListener interface, which then implements the functionality for: void onStatusChange ConnectionStatus connectionStatus — This method is called when the WebSocket connection status changes. Its connectionStatus parameter is the current status of the connection.
Its message parameter is the message received from the skill. Its message parameter is the message sent to the skill. Its eventListener parameter is an instance of type EventListener to receive updates. In-Widget Webview You can configure the link behavior in chat messages to allow users to access web pages from within the chat widget. The default text is DONE. The title is the URL of the web link that has been opened.
Multi-Lingual Chat The Android SDK's native language support enables the chat widget to both detect a user's language and allow the user to select a preferred language from a dropdown menu in the header. To enable this menu, define the multiLangChat property with an object containing the supportedLangs array, which is comprised of language tags lang and optional display labels label.
Outside of this array, you can optionally set the default language with the primary key primary: 'en' in the following snippet. When a user selects a language from this menu, the current conversation is reset, and a new conversation is started with the selected language. The language selected by the user persists across sessions in the same browser, so the user's previous language is automatically selected when the user revisits the skill through the page containing the chat widget.
Here are some things to keep in mind when configuring multi-language support: You need to define a minimum of two languages to enable the dropdown menu to display. If you omit the primary key, the widget automatically detects the language in the user profile and selects the Detect Language option in the menu. The label key is optional for the natively supported languages: fr displays as French in the menu, es displays as Spanish , and so on.
Labels for the languages can be set more dynamically by passing the labels with the i18n setting. This pattern allows setting labels for any language, supported or unsupported, and also allows translations of the label itself in different locales. While label is optional, if you've added a language that's not one of the natively supported languages, then you should add a label to identify the tag, especially when there is no i18n string for the language.
Share Menu Options By default, the share menu displays options for the following file types: visual media files images and videos audio files general files like documents, PDFs, and spreadsheets location. Note: This configuration only applies when enableAttachment is set to true.
FILE ; customItems. Speech Recognition Setting the enableSpeechRecognition feature flag to true enables the microphone button to display along with the send button whenever the user input field is empty. Speech recognition is utilized through the following methods: public static void startRecording IBotsSpeechListener listener public static void stopRecording public static boolean isRecording.
Note: This method is deprecated in Release Parameters: code — The status code message — The reason for closing the connection. It's parameter is speechData, the byte array of the recorded voice of user. Speech Synthesis The SDK has been integrated with speech synthesis to read the skill's message aloud when a new message is received from skill: Users can mute or unmute the skill's audio response using a button that's located in the header of the chat view. You enable this feature by setting the enableSpeechSynthesis feature flag to true.
You can set the preferred language that read the skill's messages aloud with the speechSynthesisVoicePreferences property. This property enables a fallback when the device doesn't support the preferred language or voice. This method should be called in the onCreate method of an Activity to initialize the speech synthesis service. The initialization of speech synthesis service will be done when the SDK library initializes only if the enableSpeechSynthesis feature flag is set to true.
Its text parameter is the text for the skill's message that's read aloud. Returns true if the skill's response is currently being read aloud. This method is called in the onDestroy method of ConversationActivity. Parameter Description application The application.
Note: This method was deprecated in Release Voice Visualizer When voice support is enabled enableSpeechRecognition true , the footer of the chat widget displays a voice visualizer, a dynamic visualizer graph that indicates the frequency level of the voice input. The chat widget displays a voice visualizer when users click the voice icon.
Note: Voice mode is indicated when the keyboard icon appears. Message Model To use features like headless mode and delegate, you need to understand both user and skill messages. Base Types These are the base types used in all messages sent from the user to the skill and vice versa. They are the building blocks of all messages. Attachment Location Action Card Message. Attachment Represents an attachment that's sent by the user. Name Description Type Required?
Location Represents a location object. Action An action represents something that the user can select. PostbackAction Sends a predefined postback back to the skill when the user selects an action. CallAction Requests the client to call a specified phone number on behalf of the user.
LocationAction Requests the client to ask for the user's location. Card Represents a single card in the message payload. Conversation Message All of the messages that are part of a conversation have the following structure: Name Description Type Required? Message Message is an abstract base type for all other messages. All messages extend it to provide some information. User Message Represents a message sent from the user to the skill.
User Text Message The simple text message that's sent to the server. User Postback Message The postback response message that's sent to the server.
User Attachment Message The attachment response message that's sent to the server. User Location Message The location response message that's sent to the server. Skill Message Represents the message sent from the skill to the user. Skill Text Message Represents a text message.
Array No globalActions An array of global actions related to the text. Array No channelExtensions Identifies special types of text message payloads. Skill Attachment Message Represents an attachment message. Name Description Type Required type The message type "attachment" Yes attachment The attachment sent Attachment Yes headerText The card's header text string No footerText the card's footer text string No actions An array of actions related to the text.
Array No. Skill Card Message Represents a set of choices that are displayed for the user, either horizontally as carousels or vertically as lists. Name Description Type Required type The message type "card" Yes layout Whether to display the messages horizontally or vertically. Array Yes headerText The cards' header text string No actions An array of actions related to the text. Skill Raw Message Used when a component creates the channel-specific payload itself. The code has the following format Description mediaType A valid media type Response items with the following attributes: type: "attachment" attachmentType: "file" or attachmentType: "image" Cards with imageUrl specified The media type of the attachment.
If not specified, the media type will be resolved from the attachment URL. The ID of the Oracle Android channel. The unique identifier for user. A randomly generated value. An instance of AuthenticationTokenProvider , which is used to generate a new token whenever the SDK needs to establish a new connection using a client authentication-enabled channel and when existing token is expired.
A field for disabling the button clicks on the messages that a user has already interacted with. Enables or disables the display of previous messages after the SDK has been re-initialized. Enables attachment sharing in the chat view. When set to true , extra headers are passed to the attachment upload requests to ensure that they can't be downloaded without passing a valid signed JWT token as an authorization header. Enables the clear message button in the header of the chat view. Enables or disables new message notifications from the SDK when the chat application is running in the background.
Enables the notification sound on new skill messages while the chat view is open. Enables the notification sound setting button in the chat view header.
Enables the speech recognition service to convert user voice to text messages. When enableSpeechRecognitionAutoSend is set to true the default , the user's speech response is automatically sent to the chat server and displays as a sent message in the chat window.
Enables the skill's audio response button in the header of the chat view. Enables the timestamp for messages. This flag, which is only applicable when enableSpeechSynthesis is true , determines whether the skill's audio response button will be active unmute by default initially, or muted.
A user text message that's used to initiate a conversation. Initializes the user profile before the conversation starts. A field used to set link handler for opening links, either in a webview or a browser. An instance of type MessageModifierDelegate which is used to receive callbacks before certain events in the conversation.
Enables the chat widget to both detect a user's language and allow the user to select a preferred language from a dropdown menu in the header. An instance of the NotificationCustomizer class which is used to customize notifications received from SDK.
Restricts the items that display in the share menu item and customizes the menu's icons and labels. Enables the display of the skill's avatar icon beside the skill's messages. Enables the connection status to display in the chat view header. The expected locale of the user's speech that's used for voice recognition. Configures the language and voice that read the skill's messages aloud by taking a list of instances that are of type SpeechSynthesisSetting as its parameter.
Sets the subtitle of the chat view, which is displayed below the title on the chat view header. Formats the timestamps that display in the messages. Refer to the Android documentation for information about valid timestamp patterns.
If you enable timestamps by setting enableTimestamp to true , you can use set a relative timestamp that appears only on the latest message by setting timestampType: 'relative'.
Sets the title in the header of the chat view. Sets the number of seconds after which the typing indicator is automatically removed if the chat view has not yet received the response.
Sets the attributes of the in-widget webview, such as its size partial or full or customizations to the clear button. Sets the configuration settings for of the webview. The background color of the action and global action buttons. The background color for the view. The background color of the card messages and their action buttons. The color that's used for buttons and progress bars on the dialog window that is shown before clearing messages and while uploading attachments. The background color of the dialog window that is shown before clearing messages and while uploading attachments.
The text color that's used in error messages. The border and cursor color of the input field in the footer. The background color of the footer. The background color of the interactive buttons in the footer. The color of the inline send button that appears within the input field when enableSpeechRecognitionAutoSend is set to true.
The background color of the input field in the footer. The background color of the interactive buttons in the header. The text color of the action buttons on the card. If you run Android Studio behind a firewall or secure network, a Proxy Settings dialog appears that enables you to configure proxy settings for the Gradle build tool that Android Studio downloads and configures.
Provide the proxy settings for your environment to ensure that the Gradle build tool functions correctly. To function correctly, the Apache Cordova command-line interface that the Oracle JET command-line interface communicates with requires that you configure environment variables. Install Android Development Tools. What Do You Need? A computer that meets the system requirements to install Android Studio.
If you run Android Studio behind a firewall or secure network, an Android Studio First Run dialog appears which displays a button Setup Proxy that you click to enter the proxy server settings for your environment.
This allows Android Studio to complete the download of the components for a standard install. In the Welcome to Android Studio dialog, select Start a new Android Studio project, and then, in the Create New Project wizard, accept the default options to progress to the final screen in the wizard and click Finish. Description of the illustration sdkmgrdialog.
0コメント