Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 359
Tripaty Sahu Avatar asked Mar 22 '23 06:03

Tripaty Sahu


2 Answers

 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)
like image 106
Tripaty Sahu Avatar answered Mar 23 '23 21:03

Tripaty Sahu


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.

like image 33
hmartinezd Avatar answered Mar 23 '23 20:03

hmartinezd