-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
|
||
This repository contains the framework and instructions for the Forethought Android SDK. | ||
|
||
You will need a valid API key in order to use the Forethought Solve SDK. In additon to the instructions below, you can also view sample apps written in Java and Kotlin. | ||
A valid API key is needed in order to use the Forethought Solve SDK. In additon to the instructions below, sample apps have been written in Java and Kotlin. | ||
|
||
## Installation | ||
|
||
### Groovy | ||
|
||
```groovy | ||
// add the jitpack maven repository to the project repositories, this can exist | ||
// inside project's build.gradle, or settings.gradle based on your project. | ||
// inside project's build.gradle, or settings.gradle. | ||
repositories { | ||
google() | ||
// jitpack repository | ||
|
@@ -29,7 +29,7 @@ dependencies { | |
|
||
```kotlin | ||
// add the jitpack maven repository to the project repositories, this can exist | ||
// inside project's build.gradle, or settings.gradle based on your project. | ||
// inside project's build.gradle, or settings.gradle. | ||
repositories { | ||
google() | ||
// jitpack repository | ||
|
@@ -46,7 +46,7 @@ dependencies { | |
|
||
## Basic Usage | ||
|
||
1. Inside your Android Application class , add the following lines to the onCreate() method: | ||
1. Inside the Android Application class, add the following lines to the onCreate() method: | ||
|
||
```java | ||
// Java | ||
|
@@ -56,40 +56,35 @@ dependencies { | |
Forethought.setup("FORETHOUGHT_API_KEY") | ||
``` | ||
|
||
1. Replace `FORETHOUGHT_API_KEY` with your API key you received from Forethought | ||
2. Replace `FORETHOUGHT_API_KEY` with a valid Forethought API key | ||
|
||
1. When you'd like to show the Forethought Solve SDK, add the following in your Activity/Fragment: | ||
3. To show / hide the Forethought Solve SDK, add the following in the `Activity/Fragment`: | ||
|
||
```java | ||
// Java | ||
Forethought.INSTANCE.show(); | ||
Forethought.INSTANCE.hide(); | ||
|
||
// Kotlin | ||
Forethought.show() | ||
Forethought.hide() | ||
``` | ||
|
||
|
||
## Optional Additions | ||
|
||
### Custom Data and Config Parameters | ||
### Custom Data Parameters | ||
|
||
You can send custom parameters that you define directly with Forethought like this: | ||
To send data parameters: | ||
|
||
```java | ||
// Java | ||
Map<String, String> configParameters = new HashMap<>(); | ||
configParameters.put("exampleConfigKey", "exampleConfigValue"); | ||
Forethought.INSTANCE.setConfigParameters(configParameters); | ||
Map<String, String> dataParameters = new HashMap<>(); | ||
dataParameters.put("language", "EN"); | ||
dataParameters.put("tracking-email", "[email protected]"); | ||
Forethought.INSTANCE.setDataParameters(dataParameters); | ||
|
||
// Kotlin | ||
val configParameters = mapOf("exampleConfigKey" to "exampleConfigValue") | ||
Forethought.configParameters = configParameters | ||
val dataParameters = mapOf( | ||
"language" to "EN", | ||
"tracking-email" to "[email protected]" | ||
|
@@ -99,16 +94,23 @@ You can send custom parameters that you define directly with Forethought like th | |
|
||
### Custom Handoff Methods | ||
|
||
If you'd like to handoff Forethought chat to another provider, you can do so by implementing the following: | ||
To handoff from Forethought to another helpdesk / provider, implement the following: | ||
|
||
1. Make your Activity/Fragment implements the ForethoughtListener interface, and override it's methods, You can inspect and view the handoffData object to access history of the previous chat. | ||
1. Make sure the `Activity/Fragment` implements the ForethoughtListener interface, and override it's methods. | ||
```java | ||
// Java | ||
public class MainActivity extends AppCompatActivity implements ForethoughtListener { | ||
// ... | ||
@Override | ||
public void forethoughtHandoffRequested(@NonNull ForethoughtHandoffData forethoughtHandoffData) { | ||
// Custom hand-off action | ||
// Custom handoff action | ||
// ... | ||
// if handoff was successful | ||
Forethought.INSTANCE.sendHandoffResponse(true); | ||
// if handoff was unsuccessful | ||
Forethought.INSTANCE.sendHandoffResponse(false); | ||
} | ||
@Override | ||
|
@@ -121,7 +123,14 @@ If you'd like to handoff Forethought chat to another provider, you can do so by | |
class MainActivity : AppCompatActivity(), ForethoughtListener { | ||
// ... | ||
override fun forethoughtHandoffRequested(handoffData: ForethoughtHandoffData) { | ||
// Custom hand-off action | ||
// Custom handoff action | ||
// ... | ||
// if handoff was successful | ||
Forethought.sendHandoffResponse(true); | ||
// if handoff was unsuccessful | ||
Forethought.sendHandoffResponse(false); | ||
} | ||
override fun onWidgetClosed() { | ||
|
@@ -130,7 +139,7 @@ If you'd like to handoff Forethought chat to another provider, you can do so by | |
} | ||
``` | ||
1. In the onCreate method, add the Activity/Fragment as a listener to the Forethought Solve SDk: | ||
2. In the onCreate method, add the `Activity/Fragment` as a listener to the Forethought Solve SDk: | ||
```java | ||
// Java | ||
@Override | ||
|
@@ -148,7 +157,7 @@ If you'd like to handoff Forethought chat to another provider, you can do so by | |
} | ||
``` | ||
1. Don't forget to remove the listener on the onDestory of your Activity/Fragment to prevent memory leaks. | ||
3. Don't forget to remove the listener on the `onDestory` of the `Activity/Fragment` to prevent memory leaks. | ||
```java | ||
// Java | ||
@Override | ||
|
@@ -169,6 +178,4 @@ If you'd like to handoff Forethought chat to another provider, you can do so by | |
|
||
### Plugins | ||
|
||
**Our Plugins are no longer supported and will be deprecated in future versions** | ||
|
||
Use your Helpdesk's SDK to handle chat handoffs however you would like in the `forethoughtHandoffRequested` method explained in the [Custom Handoff Methods](#custom-handoff-methods) section | ||
**⛔️ Our Plugins are no longer supported and will be deprecated in future versions ⛔️** |