Uni document

Open external applications in uni-app

Calling third party programs

Determine whether the third-party program already exists

In Android, it is necessary to obtain the package name of external APP in the process of development before it can be redirected to external APP, while in IOS, it is necessary to obtain the corresponding “URLscheme”. The so-called URLscheme refers to “Taobao ://” in the code below.

if (plus.os.name == 'Android') {  
    plus.runtime.launchApplication(
          {
            pname: 'com.example.thunder'
          },
          (e) = > {
            console.log('Open system default browser failed: ' + e.message)
          }
    )
} else if (plus.os.name == 'iOS') {  
    plus.runtime.launchApplication({ action: 'taobao://' }, (e) = > {  
        console.log('Open system default browser failed: ' + e.message);  
    });  
} 
Copy the code