Ich versuche, Bilder auf meinem Instagram mit meiner Android App zu teilen. aber ich bin nicht in der Lage Erfolg zu haben, wenn Bilder geteilt werden. Ich habe den Intent-Prozess verwendet, aber ich kann keinen Erfolg erzielen, wenn die Bildübertragung abgeschlossen ist.Wie bekomme ich Erfolg, wenn Instagram teilen in Android
Intent share = new Intent(Intent.ACTION_SEND);
// Limit this call to instagram
share.setPackage("com.instagram.android");
// Set the MIME type
share.setType("image/jpg");
// Create the URI from the media
File media = new File("/storage/emulated/0/DCIM/Camera/IMG_20170627_222256129_HDR.jpg");
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
try {
// Fire the Intent.
startActivityForResult(share, REQUEST_CODE);
} catch(ActivityNotFoundException e) {
// instagram not installed
}
Bereits getan, dass. Wenn ich das Bild posten, wird es nicht in der App zurückkehren. – dev
Können Sie Ihr onActivityResult bereitstellen? Nur für den Fall. – Nek
Sie können prüfen, thi @Override protected void onActivityResult (int requestCode, int Result, Intent-Daten) { Schalter (requestCode) { Fall REQUEST_CODE: if (Result == Activity.RESULT_OK) {// Hier tun Sie, was du musst. System.out.println ("Done Sharing ..."); } } } – dev