Hello I just want to call Facebook app with the link below (on my android project):
String url_facebook_prixo = "https://www.facebook.com/pages/Prixo/468580313168290";
I tried this :
Uri uri = Uri.parse("facebook://facebook.com/page{468580313168290}");
Intent viewIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(viewIntent);
I tried with others link but its only displaying my wall..
Someone?
You should use the id to open the page.
Intent facebookIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("fb://profile/468580313168290"));
startActivity(facebookIntent);
I would advice you to encapsulate this in a try catch. Inside the catch open a normal browser intent
Related
I want to share an image from android activity to facebook messenger app which is already opened in my device and reside in recent tasks of the android device.
I am using the below code to share the image but it is opening a new activity in messenger 'share seperately' but I want to share it to the already opened chat.
String mimeType = "image/*";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage("com.facebook.orca");
intent.setType(mimeType);
intent.putExtra(Intent.EXTRA_STREAM, contentUri);
intent.putExtra(EXTRA_PROTOCOL_VERSION, PROTOCOL_VERSION);
intent.putExtra(EXTRA_APP_ID, YOUR_APP_ID);
activity.startActivityForResult(shareIntent, SHARE_TO_MESSENGER_REQUEST_CODE);
Facebook has restricted the text sharing over the post. It will either support a valid URL link sharing or Image Sharing. So I've posted the code which is referenced from https://stackoverflow.com/a/22994833/8331006
private void shareAppLinkViaFacebook(String urlToShare) {
try {
Intent intent1 = new Intent();
intent1.setClassName("com.facebook.katana", "com.facebook.katana.activity.composer.ImplicitShareIntentHandler");
intent1.setAction("android.intent.action.SEND");
intent1.setType("text/plain");
intent1.putExtra("android.intent.extra.TEXT", urlToShare);
startActivity(intent1);
} catch (Exception e) {
// If we failed (not native FB app installed), try share through SEND
String sharerUrl = "https://www.facebook.com/sharer/sharer.php?u=" + urlToShare;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
startActivity(intent);
}
}
I have a URL that I want the user to open in OneNote or a web browser using an Android intent. With web browser it's easy. I just use ACTION_SEND and set the intent data with the url.
How do I add OneNote app (if available) to the list of apps to choose from as well as send this URL data?
Look at this other question, it should have all your answers
Launch OneNote using Share Intent in Android
Edit
String onPackageName = "com.microsoft.office.onenote";
Intent launchIntent = getPackageManager().
getLaunchIntentForPackage(onPackageName);
launchIntent.setAction(Intent.ACTION_SEND);
launchIntent.putExtra(Intent.EXTRA_TITLE,"Hello world");
launchIntent.putExtra(Intent.EXTRA_TEXT,"Hello world");
launchIntent.putExtra(Intent.EXTRA_SUBJECT,"htttp://www.google.com");
startActivity(launchIntent);
I solved it using the following code:
String url = link.Uri;
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent);
}
When I wanna open a page on normal facebook app (calling it through my app) I use the follow string to make the Uri.parse().
"fb://page/[pageId]", and it works normally
I do this:
String uriStr = "fb://page/[pageId]";
Uri uri = Uri.parse(uriStr);
startActivity(new Intent(Intent.ACTION_VIEW, uri));
However when I try open it in facebook lite, the same doesn't work, and my app is closed by some error. :( Exist another way? What is the correct string to open the same page in facebook lite? Anyone knows? Thx
EDIT
LogCat error:
android.content.ActivityNotFoundException: No Activity found to handle Intent
int versionCode = getPackageManager().getPackageInfo("com.facebook.lite", 0).versionCode;
if (versionCode >= 3002850) { //newer versions osf fb app
link = "fb://facewebmodal/f?href=" + FACEBOOK_URL;
} else { //older versions of fb app
link = "fb://page/" + FACEBOOK_URL;
}}
Look like this
String uri = "facebook://facebook.com/inbox";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
or for special activity
Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");
startActivity(intent);
hope it help.
uri = Uri.parse("fb://facewebmodal/f?href=" + url);
new Intent(Intent.ACTION_VIEW, uri);
Hi I'm testing on encryption & decryption of a web url & trying to develop intent to web browser.
String decrypted = DecodeAES.decrypt(AESkey, encrypted);
decryptedValue.setText(decrypted);
here i want to retrieve "decryptedValue" and to be placed in the Uri.parse
actually here the "decryptedValue" contains some website to be opened in webbrowser.
Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.com"));
startActivity(browserIntent);
Please tell me how to use Uri.parse & what to be used.
Thanks in advance.
Change -
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.google.com"));
to -
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
How can I open a url in the android web browser from my application on clicking a button.
I tried this :
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));
startActivity(myIntent);
but I am getting exception:
but I got an Exception :
"No activity found to handle Intent{action=android.intent.action.VIEW data =www.google.com"
You are doing it fundamentally correct, you just need to include the full url.
String strURL="http://www.google.com";
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));
startActivity(myIntent);
Basically, the http is the protocol. It is the computer's way of trying to figure out how you want to open it. You might also be interested in https, if you want a secure connection over SSL.
Almost seems like this would be useful to read... from the page:
Uri uri = Uri.parse("http://androidbook.blogspot.com");
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uri);
startActivity(launchBrowser);
There is a second way, involving the WebView, but that seems like it's not your question. Hope this helped.
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
Try this:
String strURL = "http://www.google.com";
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));
startActivity(myIntent);
As for the missing "http://" I'd just do something like this:
if (!url.startsWith("http://") && !url.startsWith("https://"))
url = "http://" + url;