ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
519 stars 585 forks source link

In ionic5 Applauncher is not opening another app. Always it is giving completed as false #550

Closed vneethareddy closed 3 years ago

vneethareddy commented 3 years ago

Bug Report

Plugin(s)

{ "name": "testCIO", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "~12.1.1", "@angular/compiler": "~12.1.1", "@angular/core": "~12.1.1", "@angular/forms": "~12.1.1", "@angular/platform-browser": "~12.1.1", "@angular/platform-browser-dynamic": "~12.1.1", "@angular/router": "~12.1.1", "@capacitor/android": "3.1.2", "@capacitor/app": "^1.0.0", "@capacitor/app-launcher": "^1.0.2", "@capacitor/core": "^3.0.0", "@capacitor/haptics": "1.0.2", "@capacitor/ios": "3.1.2", "@capacitor/keyboard": "1.0.2", "@capacitor/status-bar": "1.0.2", "@ionic-native/core": "^5.35.0", "@ionic-native/device": "^5.35.0", "@ionic/angular": "^5.5.2", "cordova-plugin-device": "^2.0.3", "tslib": "^2.2.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.1.1", "@angular-eslint/builder": "~12.0.0", "@angular-eslint/eslint-plugin": "~12.0.0", "@angular-eslint/eslint-plugin-template": "~12.0.0", "@angular-eslint/template-parser": "~12.0.0", "@angular/cli": "~12.1.1", "@angular/compiler": "~12.1.1", "@angular/compiler-cli": "~12.1.1", "@angular/language-service": "~12.0.1", "@capacitor/cli": "3.1.2", "@ionic/angular-toolkit": "^4.0.0", "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "4.16.1", "@typescript-eslint/parser": "4.16.1", "eslint": "^7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.2", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "protractor": "~7.0.0", "ts-node": "~8.3.0", "typescript": "~4.2.4" }, "description": "An Ionic project" }

Capacitor Version

npx cap doctor 💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 3.1.2 @capacitor/core: 3.1.2 @capacitor/android: 3.1.2 @capacitor/ios: 3.1.2

Installed Dependencies:

@capacitor/core: 3.0.0 @capacitor/cli: 3.1.2 @capacitor/android: 3.1.2 @capacitor/ios: 3.1.2

PASTE OUTPUT HERE

Platform(s)

android ios

Current Behavior

i created ionic5 app with capacitor3. now i am trying to open workday or any other app with schem and uri. in android always returns false and it wont open any another app. let app; if (this.platform.is('ios')) { app = 'com.workday.workdayapp'; } else if (this.platform.is('android')) { app = 'com.android.calendar'; } var option: OpenURLOptions = { url: app, };

AppLauncher.openUrl(option)
  .then((appopen: any) => {
    console.log('appopen  is ', appopen);
  })
  .catch((error: any) => {
    console.log('error  is ', error);
  });

Expected Behavior

it should open calendar or youtube or workday from my phone.

Screenshot 2021-08-16 at 6 54 11 PM

Code Reproduction

Other Technical Details

Additional Context

Ionitron commented 3 years ago

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks! Ionitron 💙

vneethareddy commented 3 years ago

@Ionitron i created a sample app .. If you need any help let me know. test-CIO.zip

Steps to run::

vneethareddy commented 3 years ago

@Ionitron any update on this issue. Since we need to go live our app. we are blocked with this applauncher plugin issues. Please do need full help ASAP. Thanks in advance

jcesarmobile commented 3 years ago

On iOS you can't use the app id to open the app, the app needs to have a custom URLScheme configured and should be known, not all apps have and some have but are public/known. Here you can check a list of know url schemes https://github.com/bhagyas/app-urls

On Android you can use the url scheme or the package name, that is working fine for me. Note that if you are in Android 11 device, you need to add the package to the queries entry in AndroidManifest.xml

I've added some clarifications about that on https://github.com/ionic-team/capacitor-plugins/pull/555

vneethareddy commented 3 years ago

Thanks for your quick reply let me check and update here

vneethareddy commented 3 years ago

Thanks @Ionitron . Now its working as expected.

ionitron-bot[bot] commented 2 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.