Skip to content

joaomede/cordova-launcher-list-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova - Launcher List App

About

inspired by other plugins react native and cord

how to add

cordova plugins add cordova-launcher-list-app

how to use

List All Apps

let allApps = []

async function getAllIcons () {
  return new Promise((resolve, reject) => {
    window.launcherList.getApps({
      success: (data) => {
        resolve(JSON.parse(data.result))
      }
    })
  })
}

getAllIcons().then(r => {
  // return all apps
  // [{label: "YouTube", name: "com.google.youtube, icon: 'base64 encoded'}]
  allApps = r
}).catch(err => console.log(err))

Launch a App

async function openApp (appName) {
  return new Promise((resolve, reject) => {
    window.launcherList.launch(
      { packageName: appName },
      data => {
        this.data = data
        resolve(data)
      },
      err => {
        this.data = JSON.stringify(err)
        reject(err)
      }
    )
  })
}

openApp(allApps[0].name).then(e => {
  console.log('launched')
}).catch(err => console.log(err))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published