All Projects → watson-developer-cloud → Android Sdk

watson-developer-cloud / Android Sdk

Licence: apache-2.0
🔆 Android SDK to use the IBM Watson services.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Sdk

Android Sdk Installer
Linux utility which aims to automatically install and configures Android SDK, Eclipse ADT Plugin, adds hardware support for devices and enables full MTP support.
Stars: ✭ 78 (-43.88%)
Mutual labels:  android-sdk
Android Inappbilling
A sample which uses Google's Play Billing Library and it does InApp Purchases and Subscriptions.
Stars: ✭ 114 (-17.99%)
Mutual labels:  android-sdk
Appauth Android
Android client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
Stars: ✭ 1,922 (+1282.73%)
Mutual labels:  android-sdk
Mediasoup Client Android
mediasoup android client side library https://mediasoup.org
Stars: ✭ 96 (-30.94%)
Mutual labels:  android-sdk
Livesmashbar
An elegant looking and easy to use informative library with LiveData integration for Android.
Stars: ✭ 107 (-23.02%)
Mutual labels:  android-sdk
Coeus
Android apk/sdk Scan包括android apk/sdk 安全审计代码扫描以及国内政策扫描
Stars: ✭ 122 (-12.23%)
Mutual labels:  android-sdk
Geopackage Android
GeoPackage Android Library
Stars: ✭ 72 (-48.2%)
Mutual labels:  android-sdk
Uistatus
一个简单且强大的Ui状态视图控制库!
Stars: ✭ 137 (-1.44%)
Mutual labels:  android-sdk
Cameraxdemo
A sample camera app with CameraX API from Android Jetpack
Stars: ✭ 112 (-19.42%)
Mutual labels:  android-sdk
Chucker
🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Stars: ✭ 2,169 (+1460.43%)
Mutual labels:  android-sdk
Gpslogger
📡 Lightweight GPS Logging Application For Android.
Stars: ✭ 1,348 (+869.78%)
Mutual labels:  android-sdk
Mediapicker
Easy customizable picker for all your needs in Android application
Stars: ✭ 105 (-24.46%)
Mutual labels:  android-sdk
Here Android Sdk Examples
Java-based projects using the HERE SDK for Android.
Stars: ✭ 127 (-8.63%)
Mutual labels:  android-sdk
Android Avd
Headless Android x86 emulator ready for automated instrumentation testing.
Stars: ✭ 87 (-37.41%)
Mutual labels:  android-sdk
Openlocate Android
Stars: ✭ 136 (-2.16%)
Mutual labels:  android-sdk
Apkscale
A Gradle plugin to measure the app size impact of Android libraries
Stars: ✭ 76 (-45.32%)
Mutual labels:  android-sdk
Action Android
Collection of Android-related GitHub Actions
Stars: ✭ 116 (-16.55%)
Mutual labels:  android-sdk
Ibackdrop
A library to simply use Backdrop in your project (make it easy). Read more ->
Stars: ✭ 137 (-1.44%)
Mutual labels:  android-sdk
Instabug Android
In-app feedback and bug reporting tool for apps.
Stars: ✭ 136 (-2.16%)
Mutual labels:  android-sdk
Backdoor Apk
backdoor-apk is a shell script that simplifies the process of adding a backdoor to any Android APK file. Users of this shell script should have working knowledge of Linux, Bash, Metasploit, Apktool, the Android SDK, smali, etc. This shell script is provided as-is without warranty of any kind and is intended for educational purposes only.
Stars: ✭ 1,766 (+1170.5%)
Mutual labels:  android-sdk

IBM Watson Developer Cloud Android SDK Build Status

Android client library to assist with using the Watson services, a collection of REST APIs and SDKs that use cognitive computing to solve complex problems.

Table of Contents

Installation

Gradle
'com.ibm.watson.developer_cloud:android-sdk:0.6.0'
AAR

Download the aar here.


The minimum supported Android API level is 19. Now, you are ready to see some examples.

Usage

The examples below assume that you already have service credentials. If not, you will have to create a service in IBM Cloud.

Service Credentials

Getting the Credentials

  1. Sign up for an IBM Cloud account.
  2. Create an instance of the Watson service you want to use and get your credentials:
    • Go to the IBM Cloud catalog page and select the service you want.
    • Log in to your IBM Cloud account.
    • Click Create.
    • Click Show to view the service credentials.
    • Copy the apikey value, or copy the username and password values if your service instance doesn't provide an apikey.
    • Copy the url value.

Adding the Credentials

Once you've followed the instructions above to get credentials, they should be added to the example/res/values/credentials.xml file shown below.

<resources>
  <!-- Paste Language Translator information here -->
  <string name="visual_recognition_iam_apikey"></string>
  <string name="visual_recognition_url"></string>

  <!-- Paste Speech to Text information here -->
  <string name="speech_text_iam_apikey"></string>
  <string name="speech_text_url"></string>

  <!-- Paste Text to Speech information here -->
  <string name="text_speech_iam_apikey"></string>
  <string name="text_speech_url"></string>
</resources>

Questions

If you are having difficulties using the APIs or have a question about the IBM Watson Services, please ask a question on dW Answers or Stack Overflow.

You can also check out the wiki for some additional information.

Examples

This SDK is built for use with the Watson Java SDK.

The examples below are specific for Android as they use the Microphone and Speaker; for actual services refer to the Java SDK. You can use the provided example app as a model for your own Android app using Watson services.

MicrophoneHelper

Provides simple microphone access within an activity.

MicrophoneHelper microphoneHelper = new MicrophoneHelper(this);

The MicrophoneHelper object allows you to create new MicrophoneInputStream objects and close them. The MicrophoneInputStream class is a convenience class for creating an InputStream from device microphone. You can record raw PCM data or data encoded using the ogg codec.

// record PCM data without encoding
MicrophoneInputStream myInputStream = microphoneHelper.getInputStream(false);

// record PCM data and encode it with the ogg codec
MicrophoneInputStream myOggStream = microphoneHelper.getInputStream(true);

An example using a Watson Developer Cloud service would look like

speechService.recognizeUsingWebSocket(new MicrophoneInputStream(),
getRecognizeOptions(), new BaseRecognizeCallback() {
  @Override
  public void onTranscription(SpeechResults speechResults){
    String text = speechResults.getResults().get(0).getAlternatives().get(0).getTranscript();
    System.out.println(text);
  }

  @Override
  public void onError(Exception e) {
  }

  @Override public void onDisconnected() {
  }

});

Be sure to take a look at the example app to get a working example of putting these all together.

StreamPlayer

Provides the ability to directly play an InputStream. Note: The InputStream must come from a PCM audio source. Examples include WAV files or Audio/L16.

StreamPlayer player = new StreamPlayer();
player.playStream(yourInputStream);

Since this SDK is intended to be used with the Watson APIs, a typical use case for the StreamPlayer class is for playing the output of a Watson Text to Speech call. In that case, you can specify the type of audio file you'd like to receive from the service to ensure it will be output properly by your Android device.

SynthesizeOptions synthesizeOptions = new SynthesizeOptions.Builder()
  .text("I love making Android apps")
  .accept(SynthesizeOptions.Accept.AUDIO_WAV) // specifying that we want a WAV file
  .build();
InputStream streamResult = textService.synthesize(synthesizeOptions).execute();

StreamPlayer player = new StreamPlayer();
player.playStream(streamResult); // should work like a charm

Another content type that works from the Text to Speech APIs is the Audio/L16 type. For this you need to specify the sample rate, and you can do so with the alternate version of the playStream() method. The default sample rate on the single-argument version is 22050.

SynthesizeOptions synthesizeOptions = new SynthesizeOptions.Builder()
  .text("I love making Android apps")
  .accept("audio/l16;rate=8000") // specifying our content type and sample rate
  .build();
InputStream streamResult = textService.synthesize(synthesizeOptions).execute();

StreamPlayer player = new StreamPlayer();
player.playStream(streamResult, 8000); // passing in the sample rate

CameraHelper

Provides simple camera access within an activity.

CameraHelper cameraHelper = new CameraHelper(this);
cameraHelper.dispatchTakePictureIntent();

@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == CameraHelper.REQUEST_IMAGE_CAPTURE) {
      System.out.println(cameraHelper.getFile(resultCode));
    }
  }

GalleryHelper

Like the CameraHelper, but allows for selection of images already on the device.

To open the gallery:

GalleryHelper galleryHelper = new GalleryHelper(this);
galleryHelper.dispatchGalleryIntent();

@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == GalleryHelper.PICK_IMAGE_REQUEST) {
      System.out.println(galleryHelper.getFile(resultCode, data));
    }
  }

Testing

Testing in this SDK is accomplished with Espresso.

To run the tests, in Android Studio:

Within the example package, right-click the androidTest/java folder and click Run 'All Tests'.

Build + Test

Use Gradle (version 1.x) to build and test the project you can use

Gradle:

$ cd android-sdk
$ gradle test # run tests

Open Source @ IBM

Find more open source projects on the IBM Github Page

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.

Contributing

See CONTRIBUTING.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].