Android Open Source - klarna-on-demand-android Context






From Project

Back to project page klarna-on-demand-android.

License

The source code is released under:

Apache License

If you think the Android project klarna-on-demand-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.klarna.ondemand;
/*from   www .  ja va2 s  .  c  o  m*/
/**
 * Manages the application-wide context for Klarna on Demand payments.
 */
public class Context {
    private static String apiKey;

    /**
     * Sets the API key to use in following calls.
     * @param apiKey Merchant's public API key for this application.
     */
    public static void setApiKey(String apiKey){
        Context.apiKey = apiKey;
    }

    /**
     * Returns the API key set using {@link #setApiKey(String) setApiKey}.
     * @return Merchant's public API key for this application.
     */
    protected static String getApiKey(){
        if (apiKey == null) {
            throw new RuntimeException("You must set the API key first.");
        }
        return apiKey;
    }
}




Java Source Code List

com.klarna.example.ApplicationTest.java
com.klarna.example.MainActivity.java
com.klarna.ondemand.ContextTest.java
com.klarna.ondemand.Context.java
com.klarna.ondemand.RegistrationActivity.java
com.klarna.ondemand.UrlHelperTest.java
com.klarna.ondemand.UrlHelper.java
com.klarna.ondemand.WebViewActivity.java
com.klarna.ondemand.package-info.java