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 !
Asked
Active
Viewed 354 times
1
-
1If there is no official API, this will very likely break in an app update, it's very dangerous and does not worth trying it IMHO – Waza_Be Jul 03 '13 at 21:58
-
So,what you're saying is that there is no way to send messages and files from another app other then the skype one ? No way to send intent or something ? I thought it would work,they say it is possible from other platforms... – Sorin Grecu Jul 03 '13 at 22:49
1 Answers
1
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.
-
Note that if instead of using FileProvider, you use Uri uri = Uri.fromFile(new File("/path/to/my/public/file")); the name of the file is preserved and everything is OK both when sending files over Skype, and over Viber – Jeni Mar 14 '17 at 20:58