development

Android 앱에서 Facebook 페이지를여시겠습니까?

big-blog 2020. 6. 8. 07:58
반응형

Android 앱에서 Facebook 페이지를여시겠습니까?


내 안드로이드 앱에서 공식 Facebook 앱 (물론 앱이 설치되어있는 경우)에서 Facebook 프로필에 대한 링크를 열고 싶습니다. iPhone의 경우 fb://URL 체계가 있지만 내 Android 장치에서 동일한 것을 시도하면가 발생합니다 ActivityNotFoundException.

공식 Facebook 앱에서 코드로 Facebook 프로필을 열 기회가 있습니까?


Facebook 버전 11.0.0.11.23 (3002850) fb://profile/에서 fb://page/더 이상 작동하지 않습니다. Facebook 앱을 디 컴파일하고 사용할 수 있음을 발견했습니다 fb://facewebmodal/f?href=[YOUR_FACEBOOK_PAGE]. 프로덕션에서 사용한 방법은 다음과 같습니다.

/**
 * <p>Intent to open the official Facebook app. If the Facebook app is not installed then the
 * default web browser will be used.</p>
 *
 * <p>Example usage:</p>
 *
 * {@code newFacebookIntent(ctx.getPackageManager(), "https://www.facebook.com/JRummyApps");}
 *
 * @param pm
 *     The {@link PackageManager}. You can find this class through {@link
 *     Context#getPackageManager()}.
 * @param url
 *     The full URL to the Facebook page or profile.
 * @return An intent that will open the Facebook page/profile.
 */
public static Intent newFacebookIntent(PackageManager pm, String url) {
  Uri uri = Uri.parse(url);
  try {
    ApplicationInfo applicationInfo = pm.getApplicationInfo("com.facebook.katana", 0);
    if (applicationInfo.enabled) {
      // http://stackoverflow.com/a/24547437/1048340
      uri = Uri.parse("fb://facewebmodal/f?href=" + url);
    }
  } catch (PackageManager.NameNotFoundException ignored) {
  }
  return new Intent(Intent.ACTION_VIEW, uri);
}

이것은 최신 버전에서 작동합니다.

  1. https://graph.facebook.com/<user_name_here > ( https://graph.facebook.com/fsintents)이동 하십시오.
  2. 아이디 복사
  3. 이 방법을 사용하십시오 :

    public static Intent getOpenFacebookIntent(Context context) {
    
       try {
        context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
        return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/<id_here>"));
       } catch (Exception e) {
        return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/<user_name_here>"));
       }
    }
    

사용자가 Facebook 앱을 설치 한 경우 Facebook 앱이 열립니다. 그렇지 않으면 브라우저에서 Facebook이 열립니다.

편집 : 버전 11.0.0.11.23 (3002850) 이후 Facebook 앱은 더 이상이 방법을 지원하지 않습니다. 또 다른 방법이 있습니다 .Jared Rummler에서 아래 응답을 확인하십시오.


쉽지 않습니까? 예를 들어 onClickListener 내에서?

try {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/426253597411506"));
    startActivity(intent);
} catch(Exception e) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/appetizerandroid")));
}

추신. http://graph.facebook.com/[userName]에서 ID (대수)를 얻으십시오.


Facebook 페이지의 경우 :

try {
    intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + pageId));
} catch (Exception e) {
    intent =  new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + pageId));
}

Facebook 프로필의 경우 :

try {
    intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + profileId));
} catch (Exception e) {
    intent =  new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + profileId));
}

... 아무 대답도 차이를 지적하지 않기 때문에

둘 다 Nexus 4에서 Facebook v.27.0.0.24.15 및 Android 5.0.1로 테스트되었습니다.


2016 년에 수행하고 훌륭하게 작동하며 매우 쉬운 방법이 있습니다.

나는 페이스 북으로 이메일을 보내는 방법을 살펴본 후 이것을 발견했습니다.

// e.g. if your URL is https://www.facebook.com/EXAMPLE_PAGE, you should put EXAMPLE_PAGE at the end of this URL, after the ?
String YourPageURL = "https://www.facebook.com/n/?YOUR_PAGE_NAME";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(YourPageURL));

startActivity(browserIntent);

이 작업을 수행하는 가장 간단한 코드입니다

public final void launchFacebook() {
        final String urlFb = "fb://page/"+yourpageid;
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(urlFb));

        // If a Facebook app is installed, use it. Otherwise, launch
        // a browser
        final PackageManager packageManager = getPackageManager();
        List<ResolveInfo> list =
            packageManager.queryIntentActivities(intent,
            PackageManager.MATCH_DEFAULT_ONLY);
        if (list.size() == 0) {
            final String urlBrowser = "https://www.facebook.com/pages/"+pageid;
            intent.setData(Uri.parse(urlBrowser));
        }

        startActivity(intent);
    }

더 재사용 가능한 접근 방식.

이것은 대부분의 앱에서 일반적으로 사용하는 기능입니다. 따라서 이것을 달성하기 위해 재사용 가능한 코드가 있습니다.

(사실과 관련하여 다른 답변과 유사합니다. 구현을 단순화하고 재사용 할 수 있도록 여기에 게시)

"fb://page/최신 버전의 FB 앱에서는 작동하지 않습니다. fb://facewebmodal/f?href=최신 버전을 사용해야 합니다. ( 다른 답변에서 언급 한 것처럼 )

이것은 현재 내 앱 중 하나에 존재하는 본격적인 작업 코드입니다.

public static String FACEBOOK_URL = "https://www.facebook.com/YourPageName";
public static String FACEBOOK_PAGE_ID = "YourPageName";

//method to get the right URL to use in the intent
public String getFacebookPageURL(Context context) {
        PackageManager packageManager = context.getPackageManager();
        try {
            int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
            if (versionCode >= 3002850) { //newer versions of fb app
                return "fb://facewebmodal/f?href=" + FACEBOOK_URL;
            } else { //older versions of fb app
                return "fb://page/" + FACEBOOK_PAGE_ID;
            }
        } catch (PackageManager.NameNotFoundException e) {
            return FACEBOOK_URL; //normal web url
        }
    }

이 메소드는 앱이 설치된 경우 올바른 URL을, 앱이 설치되지 않은 경우 웹 URL을 반환합니다.

그런 다음 다음과 같이 의도를 시작하십시오.

Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
String facebookUrl = getFacebookPageURL(this);
facebookIntent.setData(Uri.parse(facebookUrl));
startActivity(facebookIntent);

그게 당신이 필요한 전부입니다.


"fb://page/최신 버전의 FB 앱에서는 작동하지 않습니다. fb://facewebmodal/f?href=최신 버전을 사용해야 합니다.

이것은 본격적인 작업 코드입니다.

public static String FACEBOOK_URL = "https://www.facebook.com/YourPageName";
public static String FACEBOOK_PAGE_ID = "YourPageName";

//method to get the right URL to use in the intent
public String getFacebookPageURL(Context context) {
        PackageManager packageManager = context.getPackageManager();
        try {
            int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
            if (versionCode >= 3002850) { //newer versions of fb app
                return "fb://facewebmodal/f?href=" + FACEBOOK_URL;
            } else { //older versions of fb app
                return "fb://page/" + FACEBOOK_PAGE_ID;
            }
        } catch (PackageManager.NameNotFoundException e) {
            return FACEBOOK_URL; //normal web url
        }
    }

이 메소드는 앱이 설치된 경우 올바른 URL을, 앱이 설치되지 않은 경우 웹 URL을 반환합니다.

그런 다음 다음과 같이 의도를 시작하십시오.

Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
String facebookUrl = getFacebookPageURL(this);
facebookIntent.setData(Uri.parse(facebookUrl));
startActivity(facebookIntent);

이것은 FrAndroid 포럼 에서 Pierre87에 의해 리버스 엔지니어링 되었지만, 그것을 설명하는 공식을 찾을 수 없으므로 문서화되지 않은 것으로 취급되어 언제든지 작동을 멈출 수 있습니다.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
intent.putExtra("extra_user_id", "123456789l");
this.startActivity(intent);

이 코드를 사용해보십시오 :

String facebookUrl = "https://www.facebook.com/<id_here>";
        try {
            int versionCode = getPackageManager().getPackageInfo("com.facebook.katana", 0).versionCode;
            if (versionCode >= 3002850) {
                Uri uri = Uri.parse("fb://facewebmodal/f?href=" + facebookUrl);
                   startActivity(new Intent(Intent.ACTION_VIEW, uri));
            } else {
                Uri uri = Uri.parse("fb://page/<id_here>");
                startActivity(new Intent(Intent.ACTION_VIEW, uri));
            }
        } catch (PackageManager.NameNotFoundException e) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(facebookUrl)));
        }

이를 위해서는 "Facebook page id"가 필요합니다.

  • 페이지에서 "정보"로 이동하십시오.
  • "추가 정보"섹션으로 이동하십시오.

라 데크 리피 시온 드 라 이미지

지정된 프로필 페이지에서 페이스 북 앱을 열려면

당신은 이것을 할 수 있습니다 :

 String facebookId = "fb://page/<Facebook Page ID>";
  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(facebookId)));

또는 페이스 북 앱이 설치되어 있지 않은지 확인한 다음 페이스 북 웹 페이지를 열 수 있습니다.

String facebookId = "fb://page/<Facebook Page ID>";
String urlPage = "http://www.facebook.com/mypage";

     try {
          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(facebookId )));
        } catch (Exception e) {
         Log.e(TAG, "Application not intalled.");
         //Open url web page.
         startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        }

많은 테스트를 거친 후 가장 효과적인 솔루션 중 하나를 발견했습니다.

private void openFacebookApp() {
    String facebookUrl = "www.facebook.com/XXXXXXXXXX";
    String facebookID = "XXXXXXXXX";

    try {
        int versionCode = getActivity().getApplicationContext().getPackageManager().getPackageInfo("com.facebook.katana", 0).versionCode;

        if(!facebookID.isEmpty()) {
            // open the Facebook app using facebookID (fb://profile/facebookID or fb://page/facebookID)
            Uri uri = Uri.parse("fb://page/" + facebookID);
            startActivity(new Intent(Intent.ACTION_VIEW, uri));
        } else if (versionCode >= 3002850 && !facebookUrl.isEmpty()) {
            // open Facebook app using facebook url
            Uri uri = Uri.parse("fb://facewebmodal/f?href=" + facebookUrl);
            startActivity(new Intent(Intent.ACTION_VIEW, uri));
        } else {
            // Facebook is not installed. Open the browser
            Uri uri = Uri.parse(facebookUrl);
            startActivity(new Intent(Intent.ACTION_VIEW, uri));
        }
    } catch (PackageManager.NameNotFoundException e) {
        // Facebook is not installed. Open the browser
        Uri uri = Uri.parse(facebookUrl);
        startActivity(new Intent(Intent.ACTION_VIEW, uri));
    }
}

내 대답은 joaomgcd의 널리 받아 들여진 대답 위에 작성됩니다. 사용자가 Facebook을 설치했지만 비활성화 한 경우 (예 : 앱 검역소 사용)이 방법은 작동하지 않습니다. Twitter 앱의 의도가 선택되지만 사용 중지되어 처리 할 수 ​​없습니다.

대신에:

context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/620681997952698"));

다음을 사용하여 수행 할 작업을 결정할 수 있습니다.

PackageInfo info = context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
if(info.applicationInfo.enabled)
    return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/620681997952698"));
else
    return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/620681997952698"));

내가 찾은 가장 좋은 대답은 훌륭하게 작동한다는 것입니다.

브라우저에서 Facebook의 페이지로 이동 한 다음 마우스 오른쪽 버튼을 클릭하고 "소스 코드보기"를 클릭 한 후 page_id속성 을 찾으십시오 . page_id마지막 백 슬래시 다음에이 줄에서 사용해야 합니다.

fb://page/pageID

예를 들면 다음과 같습니다.

Intent facebookAppIntent;
try {
    facebookAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/1883727135173361"));
    startActivity(facebookAppIntent);
} catch (ActivityNotFoundException e) {
    facebookAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://facebook.com/CryOut-RadioTv-1883727135173361"));
    startActivity(facebookAppIntent);
}

Intent intent = null;
    try {
        getPackageManager().getPackageInfo("com.facebook.katana", 0);
        String url = "https://www.facebook.com/"+idFacebook;
        intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href="+url));
    } catch (Exception e) {
        // no Facebook app, revert to browser
        String url = "https://facebook.com/"+idFacebook;
        intent = new Intent(Intent.ACTION_VIEW);
        intent .setData(Uri.parse(url));
    }
    this.startActivity(intent);

2018 년 7 월 현재 모든 기기에서 Facebook 앱을 사용하거나 사용하지 않고 완벽하게 작동합니다.

private void goToFacebook() {
    try {
        String facebookUrl = getFacebookPageURL();
        Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
        facebookIntent.setData(Uri.parse(facebookUrl));
        startActivity(facebookIntent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

private String getFacebookPageURL() {
    String FACEBOOK_URL = "https://www.facebook.com/Yourpage-1548219792xxxxxx/";
    String facebookurl = null;

    try {
        PackageManager packageManager = getPackageManager();

        if (packageManager != null) {
            Intent activated = packageManager.getLaunchIntentForPackage("com.facebook.katana");

            if (activated != null) {
                int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;

                if (versionCode >= 3002850) {
                    facebookurl = "fb://page/1548219792xxxxxx";
                }
            } else {
                facebookurl = FACEBOOK_URL;
            }
        } else {
            facebookurl = FACEBOOK_URL;
        }
    } catch (Exception e) {
        facebookurl = FACEBOOK_URL;
    }
    return facebookurl;
}

앱에서 페이스 북 페이지 를 시작하려면 urlString = "fb : // page / your_fb_page_id"

페이스 북 메신저 를 시작하려면 urlString = "fb-messenger : // user / your_fb_page_id"

FB 페이지 ID는 일반적으로 숫자입니다. 확인하려면 내 FB ID 찾기로 이동 하여 www.facebook.com/edgedevstudio 와 같은 프로필 URL을 입력 한 다음 "Find Numberic ID"를 클릭하십시오.

Voila, 이제 fb 숫자 ID가 있습니다. "your_fb_page_id"를 생성 된 숫자 ID로 바꾸십시오

 val intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlString))
 if (intent.resolveActivity(packageManager) != null) //check if app is available to handle the implicit intent
 startActivity(intent)

fun getOpenFacebookIntent(context: Context, url: String) {
    return try {
        context.packageManager.getPackageInfo("com.facebook.katana", 0)
        context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/$url/")))
    } catch (e: Exception) {
        context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
    }
}

앱이 존재하지 않으면 크롬에서 여는 경우 페이스 북 페이지를 페이스 북 앱으로 여는 방법을 만들었습니다.

    String socailLink="https://www.facebook.com/kfc";
    Intent intent = new Intent(Intent.ACTION_VIEW);
    String facebookUrl = Utils.getFacebookUrl(getActivity(), socailLink);
    if (facebookUrl == null || facebookUrl.length() == 0) {
        Log.d("facebook Url", " is coming as " + facebookUrl);
        return;
    }
    intent.setData(Uri.parse(facebookUrl));
    startActivity(intent);

Utils.class는 이 메소드를 추가합니다

public static String getFacebookUrl(FragmentActivity activity, String facebook_url) {
    if (activity == null || activity.isFinishing()) return null;

    PackageManager packageManager = activity.getPackageManager();
    try {
        int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
        if (versionCode >= 3002850) { //newer versions of fb app
            Log.d("facebook api", "new");
            return "fb://facewebmodal/f?href=" + facebook_url;
        } else { //older versions of fb app
            Log.d("facebook api", "old");
            return "fb://page/" + splitUrl(activity, facebook_url);
        }
    } catch (PackageManager.NameNotFoundException e) {
        Log.d("facebook api", "exception");
        return facebook_url; //normal web url
    }
}

 /***
 * this method used to get the facebook profile name only , this method split domain into two part index 0 contains https://www.facebook.com and index 1 contains after / part
 * @param context contain context
 * @param url contains facebook url like https://www.facebook.com/kfc
 * @return if it successfully split then return "kfc"
 *
 * if exception in splitting then return "https://www.facebook.com/kfc"
 *
 */
 public static String splitUrl(Context context, String url) {
    if (context == null) return null;
    Log.d("Split string: ", url + " ");
    try {
        String splittedUrl[] = url.split(".com/");
        Log.d("Split string: ", splittedUrl[1] + " ");
        return splittedUrl.length == 2 ? splittedUrl[1] : url;
    } catch (Exception ex) {
        return url;
    }
}

작업 코드는 pageID를 사용하는 코드입니다. 방금 테스트했으며 기능적입니다.

public static void openUrl(Context ctx, String url){
    Uri uri = Uri.parse(url);
    if (url.contains(("facebook"))){
        try {
            ApplicationInfo applicationInfo = ctx.getPackageManager().getApplicationInfo("com.facebook.katana", 0);
            if (applicationInfo.enabled) {
                uri = Uri.parse("fb://page/<page_id>");
                openURI(ctx, uri);
                return;
            }
        } catch (PackageManager.NameNotFoundException ignored) {
            openURI(ctx, uri);
            return;
        }
    }

조각 형태의 oncreate를 사용하여 webview 에서이 형식으로 구현했습니다.

 webView.setWebViewClient(new WebViewClient()
{
    public boolean shouldOverrideUrlLoading(WebView viewx, String urlx)
                {
     if(Uri.parse(urlx).getHost().endsWith("facebook.com")) {
                        {
                            goToFacebook();
                        }
                        return false;
                    }
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlx));
                    viewx.getContext().startActivity(intent);
                    return true;
                }

});

onCreateView 외부 :

 private void goToFacebook() {
        try {
            String facebookUrl = getFacebookPageURL();
            Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
            facebookIntent.setData(Uri.parse(facebookUrl));
            startActivity(facebookIntent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //facebook url load
    private String getFacebookPageURL() {
        String FACEBOOK_URL = "https://www.facebook.com/pg/XXpagenameXX/";
        String facebookurl = null;

        try {
            PackageManager packageManager = getActivity().getPackageManager();

            if (packageManager != null) {
                Intent activated = packageManager.getLaunchIntentForPackage("com.facebook.katana");

                if (activated != null) {
                    int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;

                    if (versionCode >= 3002850) {
                        facebookurl = "fb://page/XXXXXXpage_id";
                    }
                } else {
                    facebookurl = FACEBOOK_URL;
                }
            } else {
                facebookurl = FACEBOOK_URL;
            }
        } catch (Exception e) {
            facebookurl = FACEBOOK_URL;
        }
        return facebookurl;
    }

페이스 북 SDK를 사용하지 않고 버튼 클릭 이벤트에서 FB 열기

 Intent FBIntent = new Intent(Intent.ACTION_SEND);
    FBIntent.setType("text/plain");
    FBIntent.setPackage("com.facebook.katana");
    FBIntent.putExtra(Intent.EXTRA_TEXT, "The text you wanted to share");
    try {
        context.startActivity(FBIntent);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(context, "Facebook have not been installed.", Toast.LENGTH_SHORT).show( );
    }

1-ID를 이미지 프로필로 이동하고 마우스 오른쪽 버튼을 클릭하고 링크 복사 주소를 가져옵니다.

        try {
                Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("fb://profile/id"));
                startActivity(intent);
            } catch(Exception e) {
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("facebook url")));
            }
        }
    });

상수 선언

  private String FACEBOOK_URL="https://www.facebook.com/approids";
    private String FACEBOOK_PAGE_ID="approids";

방법 선언

public String getFacebookPageURL(Context context) {
        PackageManager packageManager = context.getPackageManager();
        try {
            int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;

            boolean activated =  packageManager.getApplicationInfo("com.facebook.katana", 0).enabled;
            if(activated){
                if ((versionCode >= 3002850)) {
                    Log.d("main","fb first url");
                    return "fb://facewebmodal/f?href=" + FACEBOOK_URL;
                } else {
                    return "fb://page/" + FACEBOOK_PAGE_ID;
                }
            }else{
                return FACEBOOK_URL;
            }
        } catch (PackageManager.NameNotFoundException e) {
            return FACEBOOK_URL;
        }
    }

통화 기능

Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
                String facebookUrl = getFacebookPageURL(MainActivity.this);
                facebookIntent.setData(Uri.parse(facebookUrl));
                startActivity(facebookIntent);

try {
       String[] parts = url.split("//www.facebook.com/profile.php?id=");
       getPackageManager().getPackageInfo("com.facebook.katana", 0);
       startActivity(new Intent (Intent.ACTION_VIEW, Uri.parse(String.format("fb://page/%s", parts[1].trim()))));
    } catch (Exception e) {
       startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    }

다음과 같이 버튼 클릭시 페이스 북 앱을 열 수 있습니다.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    this.findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            startNewActivity("com.facebook.katana");
        }
    });

}

public void startNewActivity( String packageName)
{
    Intent intent = MainActivity.this.getPackageManager().getLaunchIntentForPackage(packageName);
    if (intent != null)
    {
        // we found the activity
        // now start the activity
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
    else
    {
        // bring user to the market
        // or let them choose an app?
        intent = new Intent(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setData(Uri.parse("market://details?id="+packageName));
        startActivity(intent);
    }
}

참고 URL : https://stackoverflow.com/questions/4810803/open-facebook-page-from-android-app

반응형