Я пытаюсь отправить изображение URL в истории Instagram. Я написал свой код на странице разработчиков Facebook о том, как отправить изображение в Instagram, но когда я нажимаю кнопку, я получаю следующую ошибку:
Process: com.example.notification, PID: 8453
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.notification/com.example.notification.PublishInstaStoryActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.instagram.share.ADD_TO_STORY dat=https://swonkiestorage.blob.core.windows.net/... typ=image/* flg=0x1 }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3303)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.instagram.share.ADD_TO_STORY dat=https://swonkiestorage.blob.core.windows.net/... typ=image/* flg=0x1 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1981)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1636)
at android.app.Activity.startActivityForResult(Activity.java:4762)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
at android.app.Activity.startActivityForResult(Activity.java:4702)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
at com.example.notification.PublishInstaStoryActivity.onCreate(PublishInstaStoryActivity.java:33)
at android.app.Activity.performCreate(Activity.java:7383)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Мой код
Intent receiveIntent = getIntent();
final String receiveImage = receiveIntent.getStringExtra("image");
Uri backgroundAssetUri = Uri.parse(receiveImage);
System.out.println(backgroundAssetUri);
Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");
intent.setDataAndType(backgroundAssetUri, "image/*");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Activity activity = this;
activity.startActivityForResult(intent, 0);