简体   繁体   中英

Launch native apps from custom cordova app

I'm developing a mobile app with Cordova (in Intel XDK) which is a list of buttons that launches other apps.

So far I've managed to launch phone app ( href="tel://" ), sms ( href="sms:// ) and google website in browser ( href="http://google.com" ).

I've found a plugin for starting apps: https://github.com/lampaa/com.lampa.startapp but basing on guide provided there I can launch an app with code like this (example) :

navigator.startApp.start([["app.com.name", "app.com.name.Activity"], [{"product_id":"100"}]], ...);

But how can I find those full app names (these app.com.name strings) ?

I need names for these apps (or way how to open them):

  • Videos (default app for android),
  • Pictures / Camera Roll (default app for android),
  • Camera,
  • WiFi settings,
  • Bluetooth settings,
  • Browser window with blank or home page opened.

Just to remind: I don't want to sync any data between these apps and mine - I just want simply to launch it via my app.

If You have other solutions - I'm open for any suggestions.

Videos (default app for android),

Requires InAppBrowser Plugin to be installed. In your code simply call cordova.InAppBrowser.open('videos://', '_system', 'location=yes');

Pictures / Camera Roll (default app for android) & Camera

Requires Camera Plugin. navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);

Settings

Check out this Native Settings Plugin

Browser window with blank or home page opened.

Requires InAppBrowser Plugin to be installed. In your code simply call cordova.InAppBrowser.open('http://google.org', '_system', 'location=yes'); This will open the default browser installed.

Many apps have well known URL Schemes defined that you can use to open app directly with. Heres a list . Whichever app URL you're using, make sure you add it to your whitelist in config.xml . <allow-intent href="twitter:*" /> <allow-intent href="mailto:*" /> The more recent approach is to use Universal Links as apposed to the URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM