Url to open facebook app in android

Possible duplicate:
Open Facebook page from Android app

I have a webview in an Android app and I would like to add a link in which the facebook app for my fan page will open. In iOS, you can say fb: // ... and it will open the facebook application. Is there any way to do this in Android? I already override shouldOverrideUrlLoading, so I could intercept it and run the intent if I need to.

+7
source share
2 answers

You need to use intentions. Here's how to invoke the FB application (if installed):

Intent intent = new Intent(); intent.setClassName("com.facebook.katana","com.facebook.katana.ProxyAuth"); intent.putExtra("client_id", applicationId); mAuthActivityCode = activityCode; activity.startActivityForResult(intent, activityCode); 

This code is taken from the Facebook API, which allows action. Rather, according to your needs. Code - Copyright 2010 Facebook, Inc., licensed under the Apache License, version 2.0.

+6
source
 myWebView = (WebView) findViewById(R.id.webview); // Create an instance of WebView and set it to the layout component created with id webview in main.xml myWebView.getSettings().setJavaScriptEnabled(true); myWebView.loadUrl("http://m.facebook.com/pages/xxxxx-xxxxx-xxxxx/xxxxxxxxxx"); // Specify the URL to load when the application starts //myWebView.loadUrl("file://sdcard/"); // Specify a local file to load when the application starts. Will only load file types WebView supports myWebView.setWebViewClient(new WebViewKeep()); myWebView.setInitialScale(1); // Set the initial zoom scale myWebView.getSettings().setBuiltInZoomControls(true); // Initialize zoom controls for your WebView component myWebView.getSettings().setUseWideViewPort(true); // Initializes double-tap zoom control 

Check if this works for you.

0
source

All Articles