from my 안드로이드 애플리케이션 (앱) 을 열 수 있는 페이스북 프로필 싶다 https://partner. microsoft. 공식 페이스북 앱 (app 가 설치되어 있는 경우, 물론). Iphone 을 위한 이 같은 일이 있지만, '존재한다' uirl 구성표가 fb:// 하고 있는 '스티비티노푸네스세페시옹' on my 안드로이드 디바이스 던진다.
App 의 공식 페이스북 (facebook) 에서 코드 프로파일할 열 수 있는 기회가 있습니까?
이 작품은 최신 버전:
공용 정적 의도 제오픈파시오부킨테나 (컨텍스트로 컨텍스트로) {
try { 그제프라카제인포 콘테스트롬제프라카제국거 () (, " com.facebook.katana", 0); 새로운 반품하십시오 의도 (Intent.ACTION_VIEW, 우리드패스 (" fb://page/< " id_here>;;;)); (예외 e) {} catch 새 의도 (intent.action_view, 우리드패스 (", https://www.facebook.com/ 복귀하십시오 user_name_here> " <;;)); } }
이 경우 페이스북 사용자가 앱을 열어 it 설치되었음. 그렇지 않으면 페이스북 브라우저에서 열립니다.
편집: 이후 버전 11.0.0.11.23 페이스북 앱 (3002850) 의 또 다른 방법은 더 이상 지원하지 않는 이렇게 there& # 39 에서 재러드 루메러 아래 응답 확인합니다.
버전 (3002850) '에서' 와 '페이스북' 더 이상 통하지 않는 11.0.0.11.23 fb://profile/ fb://page/. 난 페이스북 앱을 사용할 수 있는 '디 컴파일 및 com/downloads/global/corporate/iar/esg_prosupport. 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);
}
이게 인간들의 간소화하는지? 예를 들어 내의 onc리크리스트너?
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/ [sername] 에서 전달하십시오 id (대형 번호임) ps.
위한 페이스북 페이지:
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));
}
위한 페이스북 프로필:
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));
}
어느 누구도 정답을 방향점 아웃해야 리베카우스 차이
넥서스 4 와 안드로이드 5.0.1 에서 모두 함께 테스트되었습니다 27.0.0.24.15 페이스북 v.
이 후 페이스북 앱 어떻게 보낼 이메일을 통해 살펴보는 것도 우리 사회의 열었다.
// 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 " fb://page/ 콩지름에 '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 을 app.
그럼 의도 다음과 같습니다.
Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
String facebookUrl = getFacebookPageURL(this);
facebookIntent.setData(Uri.parse(facebookUrl));
startActivity(facebookIntent);
'앱' 를 사용할 수 없으며, 새로운 버전의 FB " fb://page/ 콩지름에 '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 을 app.
그럼 의도 다음과 같습니다.
Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
String facebookUrl = getFacebookPageURL(this);
facebookIntent.setData(Uri.parse(facebookUrl));
startActivity(facebookIntent);
지금까지 역설계할 에 의해 Pierre87 프랑드로이드 포럼 # 39, t, but I can& 설명하는 어디든요 찾기 때문에 it& # 39, s 는 공식 문서화되지 않은 및 대해 정지점을 apc® 해석하도록 어느 순간.
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)));
}
그렇게 하려면 " 할 수 있습니다, 페이스북 페이지 id" 이해했소:
! [린트로두시르 la descripci& #, # 237 aqu& 이마겐 de la 243, n] [1]
이 작업을 수행할 수 있습니다.
String facebookId = "fb://page/<Facebook Page ID>";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(facebookId)));
페이스북 (facebook 앱 설치되어 있지 않은 경우, 또는 확인할 수 있습니다 다음 열어보려면 웹 페이지.
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));
}
}
그냥 페이스북 페이지에 브라우저에서 오른쪽 클릭 후 '를 클릭하면,, 소스 보기 code" " page_id 찾습니다' 속성: '마지막' here 이 줄을 백슬래시 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);
}
내 질문에 대한 답변을 토대로 때리는 호아오 리스트. 만약 사용자가 페이스북 설치되어 있지만 해제됨 (예를 들어 사용하여 앱을 격리합니다), 이 방법을 사용할 수 없습니다. 트위터 앱이 의도 위해 선택한 것은 처리할 수 없게 정보기술 (it) 을 사용할 수 없게 됩니다.
대신:
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"));
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);
이 작품은 7월 2018년 페이스북 앱 없이 완벽하게 vmware. 관한 모든 디바이스입니다.
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;
}
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);
이러한 방법을 추가 우틸s.클레스
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;
}
}
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)))
}
}
너희가운데 상수입니다
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);
, 페이스북 페이지를 통해 사용자의 앱 출시 = " fb://page/your_fb_page_id" 우얼스트링 하겠습니다.
, 이제 페이스북 선지자께 우얼스트링 = " fb-messenger://user/your_fb_page_id" 시작할 예정이다.
FB 페이지 id 는 대개 숫자. 그것을 얻기 위해, 이동, 뭔가 같은 url 입력을 프로파일할 찾기 FB ID www.facebook.com/edgedevstudio 를 차례로 groupx 노엄브리히 ID" ";).
이제 사용자 id 를 복귀시킴 " your_fb_page_id", 숫자, fb 짜잔 숫자 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)