从一个应用程序编程与放大器启动Skype的;传递号 - 机器人放大器、机器人、应用程序、Skype

由网友(脚踏实地.)分享简介:尝试推出并通过电话。没有。从我的应用程序这个code Skype的:Trying to launch and pass tel. no. to skype by this code from my app:PackageManager packageManager = getPackageManager();In...

尝试推出并通过电话。没有。从我的应用程序这个code Skype的:

Trying to launch and pass tel. no. to skype by this code from my app:

PackageManager packageManager = getPackageManager();
Intent skype = packageManager.getLaunchIntentForPackage("com.skype.raider");
skype.setData(Uri.parse("tel:65465446"));
startActivity(skype);

Skype正在启动,但它无法赶上的数量。

Skype is launched but it can't catch the number.

推荐答案

这code工作对我来说,启动两个Skype用户之间的呼叫:

This code works for me to start a call between two Skype users:

Intent sky = new Intent("android.intent.action.VIEW");
sky.setData(Uri.parse("skype:" + user_name));
startActivity(sky);

要找到这个(及其他),使用apktool打开Skype的APK。看AndroidManifest.xml中,你会看到他们所了解的意图过滤器。如果要触发这些意图过滤器中的一个,你需要做的意图,将匹配之一。这里的意图过滤器中,code以上是匹配:

To find this (and others), use apktool to open up the Skype APK. Look at the AndroidManifest.xml and you'll see all the intent filters they know about. If you want to trigger one of those intent filters, you need to make an intent that will match one. Here's the intent filter that the code above is matching:

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="skype" />
        </intent-filter>

您获得类别android.intent.category.DEFAULT免费从{{新意图()}},因此,所有剩下的工作就是设置动作和URI。

You get the category "android.intent.category.DEFAULT" for free from {{new Intent()}}, so all that remains is to set the action and the URI.

的意图过滤器的电话:URI的是这样的:

The intent filter for tel: URIs looks like this:

        <intent-filter android:icon="@drawable/skype_blue" android:priority="0">
            <action android:name="android.intent.action.CALL_PRIVILEGED" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="tel" />
        </intent-filter>

所以,你设定的动作,给意图电话:URI和一切都很好。什么情况是,Android的找到正确的提供者电话:URI。它可能会得到用户的输入到手机应用程序和Skype之间进行选择。为Skype处理电话的优先级:URI的零,这是最低的。因此,如果安装了手机应用程序,它可能会获得的意图。

So you set to the action and give the Intent a tel: URI and "the right thing happens". What happens is that Android finds the correct provider for the tel: URI. It might get the user's input to choose between the Phone App and Skype. The priority for Skype to handle tel: URIs zero, which is lowest. So if the Phone App is installed, it will probably get the Intent.

阅读全文

相关推荐

最新文章