Android Integration
What is the PRYYNT Android SDK?
Our Android SDK allows you to add the PRYYNT button into your app in a few minutes! Your users will then be able to order prints using any of the images in your app or on their device. After clicking the PRYYNT button the PRYYNT UI will open up as an in-app browser. To integrate our SDK please follow the simple steps below.
You can download our SDK, including the full source code, an example app and tests here (4.8MB).
Step 1
The following steps are based on the Eclipse IDE. If you are looking to import the project into Android Studio instead, please refer to the Readme_AndroidStudio.docx included into the downloadable package.
- Import the pryynt-plugin project File -> Import -> Android -> Existing Android Code into Workspace
- Add the pryynt-plugin library into your project Project -> Properties -> Android -> Add -> pryynt-plugin
Set your AndroidManifest.xml as below:
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <activity android:name="com.pryynt.plugin.api.PryyntAppActivity" android:label="@string/title_activity_pryynt_app" android:theme="@android:style/Theme.Translucent.NoTitleBar" > </activity>
Step 2
Set the following parameters into your app using the Pryynt static class. Make sure that you replace YOUR_APP_KEY with your application API key, which you can get here.
Remember to enclose the API key in quotes, as shown below. Please note that each app or website has its own unique API key, so if you have registered several apps and websites with PRYYNT make sure you use the correct API key for each app or website.
Pryynt.setPryyntBaseUrl("https://pryynt.me/"); Pryynt.setApplicationKey("YOUR_APP_KEY"); Pryynt.setPreferredCurrency("USD"); Pryynt.setPreferredLanguage("en-gb");
Step 3
Select the products you want to make available to your users here. That's it! The PRYYNT button will now be available in your app and you can start monetizing your images.
Configuration Parameters
Below is a list of the PRYYNT SDK configuration parameters that you must use in your apps.
Parameter Name | Required | Default Value | Comments |
---|---|---|---|
setPryyntBaseUrl | Yes | None |
URL to the environment you want to use.
|
setApplicationKey | Yes | None |
The application API key, which you can obtain here. |
setPreferredLanguage | Yes | None |
The ISO-639-1 language code, followed by the ISO 3166-1 alpha-2 country code, to be used in the PRYYNT UI. The following languages are currently available:
|
setPreferredCurrency | Yes | None |
The ISO-4217 currency code that will be used in the PRYYNT UI. All prices will be shown in this currency. The following currencies are currently available:
|
Methods
The 4 methods below are available through the PRYYNT Android SDK.
Upload an image by specifying a public URL. In this case only a URL will be sent to the PRYYNT API. Our servers will request that URL and get the image. This is the ideal method for sending an image to PRYYNT since no image binary data has to be transmitted from the user's device to PRYYNT's servers.
Pryynt.uploadImageByUrl(imageUrl, new PryyntCallbackListener() { @Override public void onSuccess(PryyntResult result) { } @Override public void onFailure(PryyntResult result) { } @Override public void onProgress(int bytesWritten, int totalSize) { } @Override public void onError(Exception e) { } });
Upload an image from the device's memory (bitmap).
Pryynt.uploadImage(bitmap, new PryyntCallbackListener() { @Override public void onSuccess(PryyntResult result) { } @Override public void onFailure(PryyntResult result) { } @Override public void onProgress(int bytesWritten, int totalSize) { } @Override public void onError(Exception e) { } });
Upload an image from the device's filesystem.
Pryynt.uploadImage(filePath, new PryyntCallbackListener() { @Override public void onSuccess(PryyntResult result) { } @Override public void onFailure(PryyntResult result) { } @Override public void onProgress(int bytesWritten, int totalSize) { } @Override public void onError(Exception e) { } });
Open the PRYYNT UI.
PryyntResult pryyntResult = Pryynt.openPryyntPopup(this);