Sorin Grecu
Sorin Grecu

Reputation: 1034

Skype android api for message(IM) and file sending

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 !

Upvotes: 1

Views: 390

Answers (1)

Jeni
Jeni

Reputation: 1118

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.

Upvotes: 1

Related Questions