How to share image in google Plus through an android app?

前端 未结 6 1753
既然无缘
既然无缘 2020-12-24 07:54

I have already tried this code, but i didn\'t saw photo shared in my account.

File file = new File(\"sdcard/1346249742258.jpg\");
String photoUri = null;
pho         


        
6条回答
  •  情深已故
    2020-12-24 08:53

    Don't use absolute path.

    OnActivityResult() use this after capturing image from camera.

    Uri photoUri = intent.getData();                
    Intent shareIntent = ShareCompat.IntentBuilder.from(this)
                             .setText("Hello From Google+!")
                                 .setType("image/jpeg")
                                 .setStream(photoUri)
                                 .getIntent()
                         .setPackage("com.google.android.apps.plus");
    startActivity(shareIntent);
    

    This is working for me.

提交回复
热议问题