I want to share in G+.
As I knew there are G+ API
same as FaceBook & Twitter
.
I get this doc and follow the same process.
I have found that we can share via two different like,
And base on that I have to choose DeepLink
for sharing.
I have reach up to here
but when I try to copy and paste that code in my new_project
then its not working. says like
The constructor PlusShare.Builder(Activity) is not visible
.
I found a lot but at the end I get same API link. Don't know how to achieve this task. I have done sharing in Facebook & Twiiter but not get success in G+.
public void share_image_text_GPLUS() {
File pictureFile;
try {
File rootSdDirectory = Environment.getExternalStorageDirectory();
pictureFile = new File(rootSdDirectory, "attachment.jpg");
if (pictureFile.exists()) {
pictureFile.delete();
}
pictureFile.createNewFile();
FileOutputStream fos = new FileOutputStream(pictureFile);
URL url = new URL("http://img.youtube.com/vi/AxeOPU6n1_M/0.jpg");
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.connect();
InputStream in = connection.getInputStream();
byte[] buffer = new byte[1024];
int size = 0;
while ((size = in.read(buffer)) > 0) {
fos.write(buffer, 0, size);
}
fos.close();
} catch (Exception e) {
System.out.print(e);
// e.printStackTrace();
return;
}
Uri pictureUri = Uri.fromFile(pictureFile);
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("Hello from Google+!").setType("image/jpeg")
.setStream(pictureUri).getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
}
buttonLoadImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
share_image_text_GPLUS();
}
});