Dial Once

Android SDK Documentation

Download

This document will guide you through the integration of the Dial-Once SDK for Android.

You can find more information about the Android SDK on the dedicated page.

Installation & Setup

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Android versions
  4. Installation
  5. Request Runtime Permissions
  6. Disable SDK
  7. Environment switch
  8. Proguard
  9. Options

Introduction

This document will guide you through the integration of the the Dial-Once SDK in an application.

Prerequisites

Before you start, be sure you have the following prerequisites:

Android versions

The Dial-Once Android SDK supports Android 2.3+ (API Level 9) as the minSdkVersion.

Installation

Depending on your build system, the setup might be slightly different.

The best way to install the Dial-Once SDK for Android is to use gradle and jcenter. First add jcenter to your list of Maven repositories, if needed.

allprojects {
  repositories {
    jcenter()
  }
}

Then, add the Dial-Once SDK as a project dependency.

dependencies {
  compile 'com.dialonce:dialonce-android:+'
}

Finally, add the following line to your application class in the onCreate method.

DialOnce.init(this, "your_api_key_here");

Maven (skip this step if you are using gradle)

The aar dependency requires the use of the maven-android-plugin 4.+ with maven 3.+.

Maven repositories can be declared both in the global settings.xml and in projects pom.xml files. The pros and cons of the two approaches are largely debatable (e.g. Why Putting Repositories in your POMs is a Bad Idea).

<profiles>
  <profile>
    <id>bintray</id>
    <repositories>
      <repository>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray</name>
        <url>http://jcenter.bintray.com/</url>
      </repository>
    </repositories>
    <pluginRepositories>
      <pluginRepository>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray-plugins</name>
        <url>http://jcenter.bintray.com/</url>
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>
<activeProfiles>
  <activeProfile>bintray</activeProfile>
</activeProfiles>

Then, inside the <dependencies> tag, add the following code to the pom.xml:

<dependency>
  <groupId>com.dialonce</groupId>
  <artifactId>dialonce-android</artifactId>
  <version>2.6.14</version>
  <type>aar</type>
</dependency>

Finally, add the following line to your application class in the onCreate method.

DialOnce.init(this, "your_api_key_here");

Request Runtime Permissions

Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.

To request permissions you can simply call:

DialOnce.requestPermissions(activity);

In case if you app have own permissions handling, you can simply request permissins below with Android API, list of permissions which need by SDK listed in DialOnce.PERMISSIONS

In case if you will request permissions directly via Android API you are responsible to notify SDK about results by calling DialOnce.onRequestPermissionsResult which have a similar signature as Activity.onRequestPermissionsResult

Without these permissions, the SDK will not able to work properly.

Enable / Disable SDK at Run-time

Sometimes you need to turn off / on SDK by some conditions, there is several API to do this:

From end user point of view they both behave the same. Difference in the implementation details:

To rollback DialOnce.disable() app need to be restarted. To rollback DialOnce.setEnableCallInterception(false) app just need to call DialOnce.setEnableCallInterception(true)

So DialOnce.setEnableCallInterception(boolean) much preferred to be able perform DialOnce SDK disabling

ProGuard

Since DialOnce is already minified, please use these rules to not obfuscate the code again and to ensure the SDK is working as expected.

Insert the following rules into your proguard config file:

-keep class com.dialonce.** { *; }
-keep class com.android.internal.telephony.ITelephony { *; }
-dontwarn okio.**

Troubleshooting

Conflict with dependency ‘com.google.code.findbugs:jsr305’

SDK version 2.6.4 and above

This means that your project contains com.google.code.findbugs:jsr305 dependencies with different versions. To fix this you can break transitive relationship like this:

compile ('com.dialonce:dialonce-android:2.6.7') {
  exclude group: 'com.google.code.findbugs'
}

Unable to start receiver com.dialonce.sdk.PhoneCallReceiver: java.lang.IllegalStateException: DialOnce library not initialized! Call DialOnce.init() method first!

SDK version [2.6.0, 2.6.5]

Once you have added SDK dependency to your android project important to call DialOnce.init in Application.onCreate even if you wanna to disable SDK, otherwise it will lead to this crash.

To disable SDK you may use DialOnce.setEnableCallInterception(false).

Unable to start receiver com.dialonce.sdk.PhoneCallReceiver: java.lang.IllegalStateException: Android OS Issue. Application class should be initialized beforeBroadcastReceiver

SDK version 2.6.5

The same issue as above related to missing DialOnce.init in Application.onCreate

java.lang.NoSuchMethodError: No static method getSerial()Ljava/lang/String

SDK version [2.6.5, 2.6.6]

Affect devices with of Android 7.x and above, fixed in 2.6.7

Broken deep-link handling

SDK version 2.6.8 and below

Issue related to passing URI params in Intent’s data

Broken digitization disablig

SDK version 2.6.11

Regression issue

Reporting Bugs or Feature Requests

To report a bug or make a feature request, send us a mail to publishers@dial-once.com