启动Skype通话巴顿的onClick [英] Initiating a Skype Call with Button onClick
问题描述
我要启动按钮点击Skype通话。我抬起头,几个解决方案可用,但最让我猜的是过时的,不工作。可能有人请帮助我?我很新到Android编程。我已经低于code包括在内。任何帮助将AP preciated。
公共类MainActivity扩展AppCompatActivity {
@覆盖
保护无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.activity_main);
}
公共无效CallVideo(上下文myContext,弦乐mySkypeUri){
乌里skypeUri = Uri.parse(mySkypeUri);
意图myIntent =新意图(Intent.ACTION_VIEW,skypeUri); myIntent.setComponent(新单元名(com.skype.raider,com.skype.raider.Main));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myContext.startActivity(myIntent); 返回;
}
}
activity_main.xml中
<按钮
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=视频通话
机器人:ID =@ + ID /按钮
机器人:layout_below =@ + ID / textView3
机器人:layout_centerHorizontal =真
机器人:layout_marginTop =37dp
安卓的onClick =CallVideo/>
该方法是正确的。
有关Skype的语音呼叫:
CallVideo(getApplicationContext(),Skype的:+ skypeUserName +打电话?);
有关Skype的视频通话:
CallVideo(getApplicationContext(),Skype的:+ skypeUserName +?叫&放大器;视频=真正的);
有关Skype的聊天:
CallVideo(getApplicationContext(),Skype的:+ skypeUserName +聊天吗?);
有关Skype的电话:
CallVideo(getApplicationContext(),电话:+ phoneNumber的);
使用Intent.ACTION_VIEW将打开Skype Skype打电话页面,但通话不会被启动。
如果要启动的Skype电话需要意向的动作需要Intent.ACTION_CALL并添加权限
<使用许可权的android:NAME =android.permission.CALL_PHONE/>
和是的,不要忘记检查,如果在调用意图之前是否已安装Skype的。
I want to initiate a Skype call on button click. I looked up several solutions available but most of I am guessing are outdated and are not working. Could someone please help me with this? I am very new to Android Programming. I have included by code below. Any help will be appreciated.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void CallVideo(Context myContext, String mySkypeUri){
Uri skypeUri = Uri.parse(mySkypeUri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myContext.startActivity(myIntent);
return;
} }
activity_main.xml
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Video Call"
android:id="@+id/button"
android:layout_below="@+id/textView3"
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"
android:onClick="CallVideo"/>
The method is correct.
For Skype voice call :
CallVideo(getApplicationContext(), "skype:" + skypeUserName + "?call");
For Skype video call :
CallVideo(getApplicationContext(), "skype:" + skypeUserName + "?call&video=true");
For Skype chat :
CallVideo(getApplicationContext(), "skype:" + skypeUserName + "?chat");
For Skype phone call :
CallVideo(getApplicationContext(), "tel:" + phoneNumber);
using Intent.ACTION_VIEW will open the skype call page but call will not be initiated.
if Skype phone call need to be initiated the intent action needs to be Intent.ACTION_CALL and add permission
<uses-permission android:name="android.permission.CALL_PHONE" />
And yeah dont forget to check if Skype is installed or not before calling intents.
这篇关于启动Skype通话巴顿的onClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!