代码之家  ›  专栏  ›  技术社区  ›  Amin AmiriDarban

如何在新的Post模式下打开Instagram?

  •  0
  • Amin AmiriDarban  · 技术社区  · 7 年前

    我对Instagram API各方面都不熟悉。 但正如我所说,我想以新的post模式打开instagram。 例如:我想我知道Instagram的下载者。 Insta Downloader

    比如instadownload。 他们是如何以新的post模式打开Instagram的? 我想知道它适用于Web应用程序和Android应用程序。 所以我想用OpenDialog创建一个页面,它可以选择一张图片,然后重定向到Instagram并以新的Post模式登录。 你能帮我一下吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   shmakova    7 年前

    来自instagram docs :

    String type = "image/*";
    String filename = "/myPhoto.jpg";
    String mediaPath = Environment.getExternalStorageDirectory() + filename;
    
    createInstagramIntent(type, mediaPath);
    
    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"));
    }