Skype android api for message(IM) and file sending - android

I succeded in sending an intent to skype and calling whoever i want but now i want to be able to send IM and send files,all done in the background.Is that even possible ? I've looked over their developer page for android,it's kind of poor and doesn't say anything about this.
So,is there any way to do that ?
Thanks in advance and have a nice day !

I have almost succeeded in sending files over Skype using Intents. I am actually using one and the same intent for sending over email or skype, and I let the user choose the app they want to use to send the file. My code is:
File readF = new File(fullFileName);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.send_message_subject) + " " + myList.getName());
intent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.send_message_body));
Uri uri = FileProvider.getUriForFile(this, "my.package.fileprovider", readF);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Sending..."));
The File provider I use for sending the file is just like the one explained here: https://developer.android.com/reference/android/content/ContentProvider.html
If you like to send the file explicitly through Skype, and not let the user choose the app maybe you can use something like this:
sharingIntent.setClassName("com.twitter.android","com.twitter.android.PostActivity");
(explained here)
Why I ALMOST succeeded is that the filename is changed when sending over Skype. I haven't figured out how to fix this yet.

Related

How to share pdf with title[should not show UNTITLED]

the following code is the sharing pdf with UNTITLED.pdf
how to name the pdf
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setType("application/pdf");
String shareMessage= "dummy";
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(targetPdf));
startActivity(Intent.createChooser(sendIntent, "dummy"));
what I should put in putextra to change the shared pdf from UNTITLTED to dummy?
The activity that handles the ACTION_SEND Intent can do what it wants. There is no way to force it to do anything, in part because there are thousands of ACTION_SEND activities, each created by a different development team. So,
Some might pay attention to your EXTRA_TEXT, and some might not, as the ACTION_SEND specification only supports either EXTRA_TEXT or EXTRA_STREAM, and you are using both
Some might look at the last path segment of the Uri and assume that it is some sort of filename; others might not
So, populate the Intent as you are, perhaps tweak the values a bit, and otherwise just live with it.

How to share a link which is not visible to user

In my android app i want to share a Link to my website using intent but i dont want it to be visible to other user
example i want to share "smoe website link"
But to user it should look like "Click me to see it".
I tried this but wasnt successfull it just shows the simple text and was not clickable
<string name="app_link">Click me!</string>
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra("PostID", postID);
intent.putExtra("UserID", userID);
intent.putExtra(android.content.Intent.EXTRA_TEXT,activity.getString(R.string.app_link);
activity.startActivity(Intent.createChooser(intent, "Share"));
Any help will be really appreciated.
What you want is not realistically possible right now.
EXTRA_TEXT must always be interpreted as plain text by the receiving app. You could try using EXTRA_HTML_TEXT which was added with API 16. But many apps don't support HTML and will simply use EXTRA_TEXT instead (or not show any text at all if you omit EXTRA_TEXT).

How to send MMS without prompting to send it via gmail ,whatsapp or something else ?

When I am Using this code to send mms to specific user it shows me popup to send it via gmail,whatsapp,gtalk,message and etc. But in my case I just want to send that image as an mms to specific number that i will define in address field whithout showing any popup can any body tell me How to do this ? I googled for this and find lot of stuff on it.
Here is my code*strong text*
public void sendData(int num){
String fileString = "..."; //put the location of the file here
Intent mmsIntent = new Intent(Intent.ACTION_SEND);
mmsIntent.putExtra("sms_body", "text");
mmsIntent.putExtra("address", num);
mmsIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fileString)));
msIntent.setType("image/jpeg");
startActivity(Intent.createChooser(mmsIntent, "Send"));
}
Using an intent (like you did) is the preferred way because it's easy to implement and let the user choose his favorite app for the task of sending the MMS.
That being said you can still implement yourself the operation and send the MMS programmatically from your app by crafting and sending the appropriate HTTP request.
The following answer will provide you all the information you need: How to send image via MMS in Android?

Send Image and Text both using ACTION_SEND or ACTION_SEND_MULTIPLE

- We have tried to post image and text using the below code:
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/png");
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");
startActivity(Intent.createChooser(shareIntent,"Share"));
- We have also tried using shareIntent.setType("*/*"), but still no luck.
- When we are trying to post this on email, only text is appearing in it, and when we tried posting it on whatsapp then only the image was visible.
- We are unable to post both together, can anyone suggest the proper way of doing it.
Thank you very much in advance.
Now your code gonna work due the new updates to whatsapp, before this didn't accept this kind of intent (ACTION_SEND_MULTIPLE) because it accepts only one file at a time.

unable to attach file to an ACTION_SEND intent

I'm trying to attach a text file to an email and I'm getting a weird error that I hope someone can help me with. It works fine when the user selects the gmail app from the chooser, but if they select the built in mail application, they see a toast that says "Unable to attach file".
The code looks like this:
public static void sendMail(Context context, String emailBody, String emailSubject, String emailAddress, String attachmentFilename){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddress});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody);
if(attachmentFilename != null) {
//Add the attachment by specifying a reference to our custom ContentProvider and the specific file of interest
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + Settings.VYPR_LOG_PROVIDER_AUTHORITY + "/" + attachmentFilename));
}
context.startActivity(emailIntent);
}
Anyone have any thoughts on what might be going on here? Most of what I have seen on here has to do with the attachment being on the SD card. I actually didn't write this code myself, but it seems like that must not be the issue here since it does work if the user selects the gmail app rather than the built in one.
Thanks in advance!
I experienced the same problem long time ago. Had to make the use of the Gmail app mandatory to send attachments. I could not figure out why the built-in email app did not work.
If you are trying to receive the attachment to a specific email address, you may also consider deploying a web service to upload the attachment.
Hope it helps.

Categories

Resources