Skip to content

Getting started

Marten Rebane edited this page Jun 4, 2021 · 1 revision

Building source code with Android Studio or command line:

To easily get started with MOPP-Android project, check out Building source code with Android Studio

Modules can also be imported manually.

Getting project modules

You can find the source code under releases. Just download "Source code (zip or tar.gz)", unpack it and you're ready to go!

Adding modules to your project

  1. Download latest version of the source code if you haven't done so yet, and unpack it.
  2. In Android Studio, choose File -> New -> Import Module...
  3. Choose the directory where the unpacked source code is
  4. Import modules as needed
  5. After importing, build project

Fetch and package default configuration

Default configuration fetching and packaging is described in configuration-lib

Libdigidocpp setup

You're almost done. In order for library to work with containers, it needs to prepare a few things first. For that you need to call setup method. We recommend you to do this at earliest opportunity. Setup will take some time, so you need to make sure it finishes first before starting any container actions.

If you have imported SignLib and configuration-lib modules, example setup libdigidocpp as follows:

   public class ConfigurationProviderReceiver extends ResultReceiver {
   
        private static ConfigurationProvider configurationProvider;
        private static String tsaUrl = "http://dd-at.ria.ee/tsa";

        ConfigurationProviderReceiver(Handler handler) {
            super(handler);
        }

        @Override
        protected void onReceiveResult(int resultCode, Bundle resultData) {
            configurationProvider = resultData.getParcelable(ConfigurationConstants.CONFIGURATION_PROVIDER);
            if (resultCode == ConfigurationManagerService.NEW_CONFIGURATION_LOADED) {
                SignLib.init(this, tsaUrl, configurationProvider, "MyUserAgent");
            }
        }
    }
Clone this wiki locally