我正在寻找Eclipse的示例项目,演示Android上的Skype视频通话。我已经尝试过Stack Overflow的一些Skype意图实现,但是无法让项目构建或运行。我是初学者,所以我需要一个完整的实现和项目,我可以导入以及在Eclipse上执行此操作的说明。
以下代码显示了我应用的当前状态:
package com.example.newpro;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity
{
public void sendMessage(View view)
{
Intent skypeIntent = new Intent(Intent.ACTION_VIEW);
String contactUserName="nithya92";
skypeIntent.setData(Uri.parse("skype:" + contactUserName +
"?call&video=true"));
//make call only then use bellow given code
//skypeIntent.setData(Uri.parse("skype:" + contactUserName+ "?call"));
skypeIntent.setComponent(new ComponentName("com.skype.raider",
"com.skype.raider.Main"));
skypeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainActivity.this.startActivity(skypeIntent);
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
答案 0 :(得分:0)
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button skype=(Button)findViewById(R.id.skypevideocall);
final EditText edit = (EditText)findViewById(R.id.editText1);
// Skype Video call button click event code here
skype.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
String skypeName = edit.getText().toString();
if(skypeName.length()< 6)
Toast.makeText(getApplicationContext(), "Invalid Username:Minimun 6 Character",Toast.LENGTH_LONG).show();
Uri skypeUri = Uri.parse("skype:"+skypeName+"?call&video=true");
Intent myIntent = new Intent(Intent.ACTION_VIEW);
myIntent.setData(skypeUri);
startActivity(myIntent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
在清单文件中添加以下详细信息
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>