【问题标题】:I want to make android application to send picture, message to instagram users using instagram API我想让 android 应用程序使用 instagram API 向 instagram 用户发送图片、消息
【发布时间】:2018-09-12 16:54:08
【问题描述】:

我尝试了来自 Google 和 GitHub 的多个来源,但没有找到任何可以帮助我使用调度程序从我的 android 画廊自动发送多张图片和帖子的真实来源。有人在使用 Instagram API 吗?如果是这样,你能给我一些真实的来源吗?

【问题讨论】:

  • AFAIK Instagram API 不允许未经审查的应用程序发布图像。为了获得批准,您必须构建一个不只是为您设计的公共且独特的应用程序

标签: android instagram instagram-api instagram-graph-api instagramapi-mgp25


【解决方案1】:

您可以直接启动Intent,通过打开“分享对象”对话框将图片或视频发布到 Instagram,而不是使用 Instagram API。这需要用户交互。

String type = "image/*";
String filename = "/myPhoto.jpg";
String mediaPath = Environment.getExternalStorageDirectory() + filename;

private void createInstagramIntent(String type, String mediaPath){

    // Create the new Intent using the 'Send' action.
    Intent share = new Intent(Intent.ACTION_SEND);

    // Set the MIME type
    share.setType(type);

    // Create the URI from the media
    File media = new File(mediaPath);
    Uri uri = Uri.fromFile(media);

    // Add the URI to the Intent.
    share.putExtra(Intent.EXTRA_STREAM, uri);

    // Broadcast the Intent.
    startActivity(Intent.createChooser(share, "Share to"));
}

取自https://www.instagram.com/developer/mobile-sharing/android-intents/的代码示例

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-07
    • 1970-01-01
    相关资源
    最近更新 更多