How to share/pin message with Image in Pinterest through my Android application

2.5k views Asked by At

I am trying to integrate Pinterest to my android application and to pin/share message with image.But I am not getting any way to do this. I downloaded the Pinterest SDK and added the jar file in my project.

Following is my code snnipet.

PinIt pinIt = new PinIt();
    PinIt.setPartnerId("My ID");
    pinIt.setUrl("http://placekitten.com/400/300");
    pinIt.setImageUrl(m_cObjSocialTable.getPinterestImagePath());
    pinIt.setDescription(pMessage);
    pinIt.setListener(new PinItListener() {
        @Override
        public void onStart() {
            super.onStart();
        }

        @Override
        public void onComplete(boolean completed) {
            super.onComplete(completed);
            if (completed) {
                System.out.println("Pinit complete");
            }
        }

        @Override
        public void onException(Exception e) {
            super.onException(e);
            System.out.println("Pinit Exception");
        }
    });
    pinIt.doPinIt(this);

But it is not posting, in onComplete() we are getting false. Please help me on it

Thanks & Regards Tiru

3

There are 3 answers

3
hmartinezd On

UPDATE: With the actual PinIt SDK, the setDescription method is working correctly.

Unfortunately, there is not way. I mean, it should work with setDescription() but is not. That seems to be a bug on the pinterest SDK.

1
Patel Ankit On

Oncreate method :

PinItButton.setPartnerId("*******"); // required

PinItButton.setDebugMode(true); // optional

onclick event:

PinIt pinIt = new PinIt();
pinIt.setUrl(site url);
pinIt.setImageUrl(Image url);
pinIt.setDescription(description);
pinIt.setListener(new PinItListener() {
        @Override
        public void onStart() {
            super.onStart();
        }
        @Override
        public void onComplete(boolean completed) {
            super.onComplete(completed);
            if (completed) {
                System.out.println("Pinit complete");
            }
        }
        @Override
        public void onException(Exception e) {
            super.onException(e);
            System.out.println("Pinit Exception");
        }
    });
pinIt.doPinIt(this);

i think its work fine.

0
Tripaty Sahu On
 IntentBuilder lIntentBuilder = ShareCompat.IntentBuilder.from(this); 
Uri lPictureUri = null;
lPictureUri = Uri.fromFile(new File("mnt/sdcard/1.jpg"));
lIntentBuilder.setStream(lPictureUri);
String lType = null != lPictureUri ? "image/jpeg" : "text/plain";
lIntentBuilder.setType(lType);
lIntentBuilder.setText("My Description");
Intent shareIntent = lIntentBuilder.getIntent().setPackage("com.pinterest");
shareIntent.putExtra("com.pinterest.EXTRA_DESCRIPTION", "Messagessssssssss");
startActivity(shareIntent)