Skip to content
Demo app for developers that demonstrates the features of Onyx 5.0 SDK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

onyx-5.0-demo

Demo app for developers that demonstrates the features of Onyx 5.0 SDK

Getting Started

If you don't already have Android Studio, you can download it here.

Once Android Studio is installed, please contact us to purchase your ONYX license key here.
Note: Make sure you have updated to the latest Android SDK via the SDK Manager.

You should receive a license of the form XXXX-XXXX-XXXX-X-X at your provided e-mail address.
Next, you can clone our sample repository on the command-line using the following commands:

> cd <YOUR_DEVELOPMENT_ROOT>
> git clone https://github.com/DFTinc/onyx-5.0-demo.git

Alternatively, you can clone the project via Android Studio:
Select VCS >> Checkout from Version Control >> GitHub, and follow the on-screen instructions.

Place the trial key into app/src/main/res/values/strings.xml shown below:

...
<string name="onyx_license">XXXX-XXXX-XXXX-X-X</string>
...

This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Build >> Make Project" in Android Studio.

Now plug in your compatible device, and select Run >> Run 'app'.

Important addendum: Update your security provider to protect against SSL exploits Please see the article here: https://developer.android.com/training/articles/security-gms-provider

This is implemented in this project by adding a dependency on 'com.google.android.gms:play-services-base'.

The gist of it is to have an activity that implements ProviderInstaller.ProviderInstallListener.

In your onCreate() method, add a call to:

ProviderInstaller.installIfNeededAsync(this, this);

Then add the following code:

    /**
     * The below is for updating the device's security provider to protect against SSL exploits
     * See https://developer.android.com/training/articles/security-gms-provider#java
     */
    private static final int ERROR_DIALOG_REQUEST_CODE = 11111;
    private boolean mRetryProviderInstall;

    /**
     * This method is only called if the provider is successfully updated
     * (or is already up-to-date).
     */
    @Override
    public void onProviderInstalled() {
        Log.i("OnyxSetupActivity","Provider is up-to-date, app can make secure network calls.");
    }

    /**
     * This method is called if updating fails; the error code indicates
     * whether the error is recoverable.
     */
    @Override
    public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) {
        GoogleApiAvailability availability = GoogleApiAvailability.getInstance();
        if (availability.isUserResolvableError(errorCode)) {
            // Recoverable error. Show a dialog prompting the user to
            // install/update/enable Google Play services.
            availability.showErrorDialogFragment(
                    this,
                    errorCode,
                    ERROR_DIALOG_REQUEST_CODE,
                    new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialog) {
                            // The user chose not to take the recovery action
                            onProviderInstallerNotAvailable();
                        }
                    });
        } else {
            // Google Play services is not available.
            onProviderInstallerNotAvailable();
        }
    }

    /**
     * On resume, check to see if we flagged that we need to reinstall the
     * provider.
     */
    @Override
    protected void onPostResume() {
        super.onPostResume();
        if (mRetryProviderInstall) {
            // We can now safely retry installation.
            ProviderInstaller.installIfNeededAsync(this, this);
        }
        mRetryProviderInstall = false;
    }

    private void onProviderInstallerNotAvailable() {
        // This is reached if the provider cannot be updated for some reason.
        // App should consider all HTTP communication to be vulnerable, and take
        // appropriate action.
        Log.i("OnyxSetupActivity","ProviderInstaller not available, device cannot make secure network calls.");
    }

Finally, in your onActivityResult(int requestCode, int resultCode, Intent data), include the following:

    if (requestCode == ERROR_DIALOG_REQUEST_CODE) {
        // Adding a fragment via GoogleApiAvailability.showErrorDialogFragment
        // before the instance state is restored throws an error. So instead,
        // set a flag here, which will cause the fragment to delay until
        // onPostResume.
        mRetryProviderInstall = true;
    }

For an example, see OnyxSetupActivity.java.

Support

You can’t perform that action at this time.