问题
Developing an application, In which I have many user's account_id(skype id), Now what I want is to open chat screen of Skype (already installed in device) when I click particular User's skype_id from my application.
I did search on web but got no success Got the link how to start call on Skype but for chat?
1) Link 1
2) Link 2
回答1:
You can use the Skype URI Scheme for this (Skype:echo123?chat).
You can find out more information about the URI Scheme here : https://dev.skype.com/skype-uri
Thanks
Allen Smith Skype Developer Support Manager
回答2:
Here is the code to open Skype chat conversation:
private void openSkype(Context context) {
// Make sure the Skype for Android client is installed
if (!isSkypeClientInstalled(context)) {
goToMarket(context);
return;
}
final String mySkypeUri = "skype:echo123?chat";
// Create the Intent from our Skype URI.
Uri skypeUri = Uri.parse(mySkypeUri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
// Restrict the Intent to being handled by the Skype for Android client only.
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(myIntent);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Determine whether the Skype for Android client is installed on this device.
*/
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);
}
/**
* Install the Skype client through the market: URI scheme.
*/
public void goToMarket(Context myContext) {
Uri marketUri = Uri.parse("market://details?id=com.skype.raider");
Intent myIntent = new Intent(Intent.ACTION_VIEW, marketUri);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myContext.startActivity(myIntent);
}
来源:https://stackoverflow.com/questions/11946449/open-chat-screen-skype-from-other-app