Midhun Sivaraj
Midhun Sivaraj

Reputation: 503

How to integrate pinterest on my app?

I have an app which shows pinterest pins and boards. The Api for developing pinterest are now available on their site. Anyone explain the basic steps to do so. Thanks in advance.

Upvotes: 0

Views: 3876

Answers (1)

i_me_mine
i_me_mine

Reputation: 1433

There is a very good explination straight from pinterest here --> pinterest

However for future readers if you want to know whats in there it looks like this.

Using the SDK

Register for a Client ID
Download the documentation and SDK
First place the pinit-sdk.jar folder into YOUR_PROJECT/libs and integrate into your IDE or build system.
Then we need to do a one time setup.

PinItButton.setPartnerId("YOUR_PARTNER_ID"); // required
PinItButton.setDebugMode(true); // optional

To use the PinIt button in an XML layout first add it like so.

<com.pinterest.external.PinItButton
    android:id="@+id/pin_it"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

Next, find the button and set some properties

PinItButton pinIt = (PinItButton) findViewById(R.id.pin_it);
pinIt.setImageUrl("http://placekitten.com/400/300");
pinIt.setUrl("http://placekitten.com"); // optional
pinIt.setDescription("A place kitten!"); // optional

Alternatively, we can instantiate and add the button entirely in Java.

PinItButton pinIt = new PinItButton(this);
pinIt.setImageUrl("http://placekitten.com/400/300");
pinIt.setUrl("http://placekitten.com");
pinIt.setDescription("A place kitten!");
view.addView(pinIt);

Deep Linking

Since launch, Pinterest for Android supports deep linking of Pins, Users and Boards in two ways. First, when using the standard Android Browser or other native apps, any normal Pinterest link is capable of being opened in our app. The recommended option for developers is to use a Uri scheme as seen below.

Pin

pinterest://pinterest.com/pin/285063851385287883/

Board

pinterest://pinterest.com/meaghanror/cats-cats-cats/

User

pinterest://pinterest.com/carlrice/

Upvotes: 3

Related Questions