Home > Enterprise >  Launch skype from an android app on tablet
Launch skype from an android app on tablet

Time:07-20

I am in the process of developing with android studio on LINUX (kubuntu), in java code . I would like to launch skype from an application. I use Uri skypeUri = Uri.parse(mySkypeUri); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype4life", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myContext.startActivity(myIntent);

When i run the application on my tablet device (not virtual) samsung galaxy tab s2 android version 7.0, i get the message "unfortunately the application has stopped to working".

when i replace com.skype.raider with com.skype4life, play store is launched and loading icon keeps spinning (no response).

Could some one help me? Thanks.

In the log cat i found the followings errors:

2022-07-20 06:42:30.000 3208-3783/? E/Watchdog: !@Sync 312 [2022-07-20 06:42:30.000] 2022-07-20 06:42:32.570 13291-13291/com.limbani.aauSkype E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]] 2022-07-20 06:42:32.765 13291-13291/com.limbani.aauSkype E/AndroidRuntime: FATAL EXCEPTION: main Process: com.limbani.aauSkype, PID: 13291 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.skype.android/com.skype.android.Main}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1815) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1531) at android.app.Activity.startActivityForResult(Activity.java:4403) at android.app.Activity.startActivityForResult(Activity.java:4362) at android.app.Activity.startActivity(Activity.java:4686) at android.app.Activity.startActivity(Activity.java:4654) at com.limbani.aauSkype.MainActivity.SkypeUri(MainActivity.java:105) at com.limbani.aauSkype.MainActivity$1.onClick(MainActivity.java:33) at android.view.View.performClick(View.java:6257) at android.widget.TextView.performClick(TextView.java:11149) at android.view.View$PerformClick.run(View.java:23705) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6780) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1500) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1390)

CodePudding user response:

You can launch skype by package name:

PackageManager packageManager = getPackageManager();
startActivity(packageManager.getLaunchIntentForPackage("com.skype.raider"));

CodePudding user response:

First, you need to know if a certain app is installed, then you need to know the package name. According to the official documentation https://docs.microsoft.com/en-us/skype-sdk/skypeuris/skypeuritutorial_androidapps

/**
* 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);
}

If skype app is not installed then:

/**
 * 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);
    return;
}

Below code to open skype

/**
  * Initiate the actions encoded in the specified URI.
*/
public void initiateSkypeUri(Context myContext, String mySkypeUri) {

    // Make sure the Skype for Android client is installed.
    if (!isSkypeClientInstalled(myContext)) {
        goToMarket(myContext);
        return;
    }

    // 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);

    // Initiate the Intent. It should never fail because you've already established the
    // presence of its handler (although there is an extremely minute window where that
    // handler can go away).
    myContext.startActivity(myIntent);

    return;
}    
  • Related