gpt4 book ai didi

java - 我如何在 Skype 上玩 google?

转载 作者:行者123 更新时间:2023-12-01 12:15:19 24 4
gpt4 key购买 nike

此代码是通过 Skype 向某人发送消息,但我不知道如何设置 https://play.google.com/store/apps/details?id=com.skype.raider以防我没有 Skype。

skypename.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Uri skypeUri = Uri.parse("skype:username?chat");
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);
startActivity(myIntent);
}
});

已添加代码................................................ ...................................................... ....

skypename.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!isSkypeClientInstalled(activity)) {
Context activity;
goToMarket(activity);
return;
} else{
Uri skypeUri = Uri.parse("skype:username?chat");
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);
startActivity(myIntent);
}

public void goToMarket(Context myContext) {
Activity activity;
try {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + "com.skype.raider")));
} catch (android.content.ActivityNotFoundException anfe) {
activity. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + "com.skype.raider")));
}
return;
}
public boolean isSkypeClientInstalled(Context myContext) {
PackageManager myPackageMgr = myContext.getPackageManager();
try {
myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
}
catch (PackageManager.NameNotFoundException e) {
return (false);
}
return (true);
});

最佳答案

首先检查 Skype 是否已安装或未使用此代码。如果安装了 msg 某事。否则请前往 google play 下载 Skype

skypename.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!isSkypeClientInstalled(MainActivity.this)) {

goToMarket(MainActivity.this);
return;
} else{
Uri skypeUri = Uri.parse("skype:username?chat");
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);
startActivity(myIntent);
}
}
});

public void goToMarket(Context myContext) {

try {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + "com.skype.raider")));
} catch (android.content.ActivityNotFoundException anfe) {
activity. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + "com.skype.raider")));
}

return;
}
public boolean isSkypeClientInstalled(Context myContext) {
PackageManager myPackageMgr = myContext.getPackageManager();
try {
myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
}
catch (PackageManager.NameNotFoundException e) {
return (false);
}
return (true);
}

关于java - 我如何在 Skype 上玩 google?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27053628/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com