My sharing intent code does work with all other apps but not reddit when i try to share it with reddit i get a toast saying "Something went wrong." I tried several codes but none worked for me. Here's my current code, Please help me solving this problem.
private void share(File file){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+file.getAbsolutePath()));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(intent,"Share with..."));
}
Related
I have installed 2 Facebook app on my android device (com.facebook.katana, com.facebook.katanb).
Now, I want to open a post id on com.facebook.katanb package.
I tried as below:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://post/2377836809193490"));
intent.setPackage("com.facebook.katanb");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
However, It's not worked.
Is there anyone who could help me?
I am having a problem with android email intent.....i need to open email app so that the user can provide feedback for my app.It doesn't open when i use this..throws an ActivityNotFoundException .....i am using my phone ,not an emulator and my phone has email and gmail apps in it.
Help me solve??
Here is my code:
Intent intent= new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:"));
intent.setType("text/plain");
String[] mail={"someone#gmail.com"};
intent.putExtra(Intent.EXTRA_SUBJECT,"");
intent.putExtra(Intent.EXTRA_TEXT,"");
intent.putExtra(Intent.EXTRA_EMAIL,mail);
startActivity(intent);
Any and all comments are appreciated :)
For your case, what ActivityNotFoundException most likely means that in your phone you don't have any default email app email application installed on your device like Gmail, so when you launch the Intent you receive this error.
You can try to handle that exception like this:
try {
startActivity(Intent.createChooser(i, "Send mail"));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(Activity.this, "no email app",Toast.LENGTH_SHORT).show();
}
From the android docs, An intent allows you to start an activity in another app by describing a simple action you'd like to perform (such as "view a map" or "take a picture") in an Intent object. This type of intent is called an implicit intent because it does not specify the app component to start, but instead specifies an action and provides some data with which to perform the action.
When you call startActivity() or startActivityForResult() and pass it an implicit intent, the system resolves the intent to an app that can handle the intent and starts its corresponding Activity. If there's more than one app that can handle the intent, the system presents the user with a dialog to pick which app to use.`
So, in your case, the system couldn't find an app to resolve the intent to as #Tamir mentioned.
For more information , look into this Stack Overflow post: Send Email Intent
it works for me :
String[] recipients;
Intent intent = new Intent(Intent.ACTION_SEND);
recipients = new String[]{"someone#gmail.com"};
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.setType("text/html");
intent.setPackage("com.google.android.gm");
try {
activity.startActivity(Intent.createChooser(intent, "Send"));
}
catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(Activity.this, "no email app",Toast.LENGTH_SHORT).show();
}
I know how to add a share button in android, but when I click on it I want the intent to store the link of the same app in playstore. However, I don't understand how to do this because I am trying to find the link of an app that hasn't been published yet.
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add the app link here so that it is shown in playstore");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
I know it can be achieved via Firebase Remote configurations, but is there any other way to do so.
you can do this by following:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=" + this.getPackageName())));
this is your link after publishing app: "http://play.google.com/store/apps/details?id=" + this.getPackageName()
public void shareMessage(){
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
getContext().startActivity(Intent.createChooser(intent, "Share"));
}
When I use "text/plain", Facebook comes up as an option but the text does not load up when selecting it. But the text does load for Twitter,email, SMS.
Has anyone else encountered this problem?
As mentioned in the comments , Facebook has disabled the share intent a few years back Android and Facebook share intent , it doesn't handle EXTRA_SUBJECT or EXTRA_TEXT fields,
Use the Facebook api , Instructions found here --> https://developers.facebook.com/docs/android/share#share_options
I am trying to share link with my android app with this:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, share);
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
mContext.startActivity(intent);
this is the share Strong :
Check out my link:\n http://my123domain.com/v.php?vid=123456-123456-123456
But when i share it with Whats App the link is not click able,
Any idea Why?
Whatsapp does not allow sending clickable text links to people who do not have you in their contact list. Make sure receiving party have you in their contact list.