1. Create your Project

Start right now by creating a new project here.

2. Add Key Hash

In order to authenticate the exchange of information between your app and Wiman, you need to generate a key hash and add this to your Project settings. Without this, your Wiman SDK won’t work.

Keytool, for generating the key hashes, is included with the Java SE Development Kit (JDK) that you installed as part of setting up your development environment. OpenSSL is available for download from OpenSSL.

DEBUG KEY HASH

OSX/Linux

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl dgst -sha256 -binary | openssl base64

Windows

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl dgst -sha256 -binary | openssl base64

RELEASE KEY HASH

OS X / Windows

keytool -exportcert -alias  -keystore  | openssl dgst -sha256 -binary | openssl base64
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      try {
          PackageInfo info = getPackageManager().getPackageInfo(
              this.getPackageName(),
              PackageManager.GET_SIGNATURES);
          for (Signature signature: info.signatures) {
              MessageDigest md = MessageDigest.getInstance("SHA-256");
              md.update(signature.toByteArray());
              Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
          }
      } catch (NameNotFoundException e) {
          ...
      } catch (NoSuchAlgorithmException e) {
          ...
      }
  }

Save your changes and re-run the project. Check your logcat output for a message similar to this:

12-20 10:47:37.747: D/KeyHash:(936): 478uEnKQV+fMQT8Dy4AKvHkYibo=

This command should generate a 44 characters string. Copy and paste this Key Hash into your Project settings in Wiman Console.

3. Android Studio Setup

In order to use Wiman SDK in a project, you have to add it as a build dependency and import it.

  1. Go to Android Studio > New Project > Minimum SDK

  2. Select API 15: Android 4.0.3 or higher and create your new project.

  3. After you create a new project, open build .gradle.

  4. Add this to Module-level /app/build.gradle before dependencies:

    repositories {
        maven {
            url 'http://wiman.bintray.com/WimanWiFiSDK'
        }
    }
  5. Add the compile dependency with the latest version of the Wiman SDK in the build.gradle file:

    compile 'me.wiman.sdk:WimanWiFiSDK:1.1.8'

4. Add SDK Key

Add the SDK key in your Application Class (you can find it in your Project settings).

You MUST NOT install the SDK and not initialize it otherwise host application crashes.

public class SdkFreeApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        WimanSDK.initialize(this, YOUR_SDK_KEY_HERE);
    }
}

Add your Application class in AndroidManifest.xml

<application
  ...
  android:name=".SdkFreeApplication">
  ...
</application>

5. Show Opt-in Dialog

If you're using the Developer Plan, you can take advantage of the services offered by Wiman, through the SDK, for free. Wiman will collect anonymous location-based data that will be processed in compliance with the current regulations in terms of collection, protection and treatment, as reported in the Terms of Service.

End user explicit consent is required through the pop up.

Screenshot

This step is mandatory, otherwise the Autoconnect doesn’t work.

This example method shows the opt-in dialog:

public class MainActivity extends AppCompatActivity {

    @Override
    public void onCreate() {
        super.onCreate();
        WimanSDK.showOptin(this);
    }
}

Please refer to Documentation for details on dialog customization.

6. Build

Build your Project and see if everything works!

Note: If you are using Proguard you must also add the following lines to your Proguard file:

-dontwarn org.slf4j.**

-dontwarn javax.**