rub*_*ben 14 android skype android-intent android-activity
试图启动并传递电话.没有.从我的应用程序通过此代码skype:
PackageManager packageManager = getPackageManager();
Intent skype = packageManager.getLaunchIntentForPackage("com.skype.raider");
skype.setData(Uri.parse("tel:65465446"));
startActivity(skype);
Run Code Online (Sandbox Code Playgroud)
Skype推出但它无法捕捉到这个数字.
Jef*_*len 36
此代码适用于我在两个Skype用户之间开始通话:
Intent sky = new Intent("android.intent.action.VIEW");
sky.setData(Uri.parse("skype:" + user_name));
startActivity(sky);
Run Code Online (Sandbox Code Playgroud)
要找到这个(和其他人),使用apktool打开Skype APK.查看AndroidManifest.xml,您将看到他们了解的所有意图过滤器.如果要触发其中一个intent过滤器,则需要创建一个与之匹配的intent.这是上面代码匹配的intent过滤器:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="skype" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
你可以从{{new Intent()}}免费获得类别"android.intent.category.DEFAULT",所以剩下的就是设置动作和URI.
tel:URIs的intent过滤器如下所示:
<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>
Run Code Online (Sandbox Code Playgroud)
所以你设置为动作并给Intent一个tel:URI和"正确的事情发生".会发生什么是Android找到tel:URI的正确提供者.它可能会让用户输入在Phone App和Skype之间进行选择.Skype处理tel的优先级:URI为零,这是最低的.因此,如果安装了电话应用程序,它可能会获得意图.
小智 17
如果您想要触发视频通话,则必须在Skype URI中添加"?call&video = true".
Intent skypeVideo = new Intent("android.intent.action.VIEW");
skypeVideo.setData(Uri.parse("skype:" + "<username>" + "?call&video=true"));
startActivity(skypeVideo);
Run Code Online (Sandbox Code Playgroud)
有关Skype URI的更多信息,请参阅:http: //developer.skype.com/skype-uris-program/skype-uri-ref
如果你想在没有任何意图选择器的情况下直接进行skype调用,请在清单文件中添加这些行...
<intent-filter
android:icon="@drawable/skype"
android:priority="0" >
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter>
<intent-filter
android:icon="@drawable/skype"
android:priority="0" >
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="skype" />
</intent-filter>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19721 次 |
| 最近记录: |