I'm trying to start a Skype intent from my Android App, passing a phone number. So far, thanks to other people who ad similiar needs here on stackoverflow, I've managed to start skype, but still I can't pass the phone number. This is the code I'm using:
Intent sky = new Intent("android.intent.action.CALL_PRIVILEGED");
sky.setClassName("com.skype.raider",
"com.skype.raider.Main");
sky.setData(Uri.parse("tel:" + number));
Log.d("UTILS", "tel:" + number);
ctx.startActivity(sky);
What's happening is that skype starts, but gives me a toast saying that the number is not valid, and suggests me to add the international prefix. The Log.d gives me tel:+39........ (the number works, I'm using it also for
public static void call(String number, Context ctx) {
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + number));
ctx.startActivity(callIntent);
} catch (ActivityNotFoundException e) {
Log.e("helloandroid dialing example", "Call failed", e);
}
}
In fact, when I go to the Skype's view for calling, I see it's been composed +0 So what it seems to me is that I'm passing the phone number in the wrong way, or to the wrong Activity....any help would be very appreciated! In the meantime, I just want to say that StackOverflow simply rocks.
Download Skype for your phoneAvailable for Android, iPhone and Windows 10 Mobile.
On your phone, dial the conference number listed in your meeting request. Tip: If you're traveling, click Find a local number in the meeting request to find the numbers available for your current location. Enter the Conference ID by using your phone dial pad.
To start using Skype on your Android you will need to download it from the Google Play Store. You can get to this from your mobile's home screen. Search for 'Skype' then click on 'Install'. Once you have downloaded Skype onto your device you can now start using it.
See this answer: https://stackoverflow.com/a/8844526/819355
Jeff suggests using a skype:<user name>
instead of tel:<phone number>
After some studing of the skype apk with apktool, as suggested in that answer, I came up with this code, for me it's working:
public static void skype(String number, Context ctx) {
try {
//Intent sky = new Intent("android.intent.action.CALL_PRIVILEGED");
//the above line tries to create an intent for which the skype app doesn't supply public api
Intent sky = new Intent("android.intent.action.VIEW");
sky.setData(Uri.parse("skype:" + number));
Log.d("UTILS", "tel:" + number);
ctx.startActivity(sky);
} catch (ActivityNotFoundException e) {
Log.e("SKYPE CALL", "Skype failed", e);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With