Intent to open Instagram user profile on Android

后端 未结 6 1609
清歌不尽
清歌不尽 2020-12-02 10:38

I\'m developing a social networking app and our users can connect their Instagram account to our service. I\'d like to open Instagram profiles directly in their official And

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 10:57

    To open directly instagram app to a user profile :

    String scheme = "http://instagram.com/_u/USER";
    String path = "https://instagram.com/USER";
    String nomPackageInfo ="com.instagram.android";
        try {
            activite.getPackageManager().getPackageInfo(nomPackageInfo, 0);
            intentAiguilleur = new Intent(Intent.ACTION_VIEW, Uri.parse(scheme));
            } catch (Exception e) {
                intentAiguilleur = new Intent(Intent.ACTION_VIEW, Uri.parse(path));
            }
            activite.startActivity(intentAiguilleur); 
    
    // Use this link to open directly a picture
      String scheme = "http://instagram.com/_p/PICTURE";
    

提交回复
热议问题