Open polisettyManoj opened 2 years ago
Have you followed the guide in the docs.
https://capacitor-community.github.io/electron/docs/deeplinking
@IT-MikeS yes followed.
@IT-MikeS I created a sample application by following these steps
after that added capacitor/app plugin and followed the steps given in this document - https://capacitor-community.github.io/electron/docs/deeplinking
npm install @capacitor/app npx cap sync
App.addListener('appUrlOpen', data => { console.log('App opened with URL:', data); // not triggerring });
const checkAppLaunchUrl = async () => { const { url } = await App.getLaunchUrl();
console.log('App opened with URL: ' + url); // url always empty };
@IT-MikeS I created a sample application by following these steps
- ionic start appElectron blank --type=angular --capacitor
- npm i @capacitor-community/electron
- ionic build
- npx cap add @capacitor-community/electron
after that added capacitor/app plugin and followed the steps given in this document - https://capacitor-community.github.io/electron/docs/deeplinking
npm install @capacitor/app npx cap sync
Did you cap sync with the electron command? (npx cap sync @capacitor-community/electron)
@IT-MikeS yes (npx cap sync @capacitor-community/electron) this is also done
@IT-MikeS Can you please help me? as I was struck at this point for the past several days
Have you built this into an installable application? (gone though electron builder etc) and installed and tested as a built app? Deeplinking is only available to built applications. (Electron limitation)
@IT-MikeS I'm using "electron:build-windows": "npm run build && electron-builder build --windows --publish=never" command to build the application and tested. getLaunchURL is still empty
I'm using the capacitor App plugin and trying to get URL from which the app is opened (I need to handle deep link)
npm install @capacitor/app npx cap sync
App.addListener('appUrlOpen', data => { console.log('App opened with URL:', data); // not triggerring });
const checkAppLaunchUrl = async () => { const { url } = await App.getLaunchUrl();
console.log('App opened with URL: ' + url); // url always empty };
appUrlOpen event needs to fire and getLaunchUrl need to give deeplink Url
**Desktop - Windows
@IT-MikeS I appreciate your quick response
@IT-MikeS if possible you can create a sample project by following these steps, it won't take much time. can you test it in your Machine ?
@IT-MikeS I went through capacitor/app V3 plugin code (https://github.com/ionic-team/capacitor-plugins/blob/main/app/src/web.ts) they didn't implement several methods for the web. getLaunchUrl is simply returning an empty string.
@IT-MikeS any update on this? are you looking into this issue ?
It's on my radar but it will be a while before I dig in due to other commitments and life balance. However PRs are always welcome should you feel inclined to investigate and fix the issue in your own time.
@IT-MikeS I tried but was unable to fix it. can you fix it in your own time? or guide me to fix the issue.
--> I need to change capacitor/app plugin code ?
All the work I do on this repo is in my own time, that's open source for you 😝
Unfortunately as I do not have the time to dig into the issue at the moment I can not provide good guidance nor fix the issue without impact on my life balance.
Please be patient and understanding. The issue will get looked into in time but no guarantees are given. You may also try the Ionic discord in the capacitor community channel if anyone else may be able to assist you quicker.
Okay @IT-MikeS :)
@mlynch @danielsogl @vevedh @leMaik @stewones @coreyjv @jgoux @MathisTLD @challenger71498 @jdgjsag67251 can anyone help on this ?
AFAIK there are no official Capacitor plugins that support Electron. Unfortunately, running npm install @capacitor/app
will do nothing in Electron.
I have made two pull-requests to the plugins to add some functionality (https://github.com/ionic-team/capacitor-plugins/pull/792 & https://github.com/ionic-team/capacitor-plugins/pull/793), but neither of them have seen any action.
@jdgjsag67251 how to achieve this? any guidance?
@polisettyManoj if the app "App.addListener('appUrlOpen'...." doesnt work for you. you can expose function from main process that will return the url.
In preload.ts expose the function ipcRenderer.on (not secure) or create channel between main and renderer process to pass the URL information. (thats basically what electron capacitor platform is doing, but for some reason it didnt work for me either with App.addListener) In main process you can get it by calling
ipcRenderer.on('appUrlOpen', (url) => { })
you can read this to understand how to create a channel https://www.debugandrelease.com/the-ultimate-electron-guide/
I will try @JuliusSkrisa. Thank you very much
I'm using the capacitor App plugin and trying to get URL from which the app is opened (I need to handle deep link)
npm install @capacitor/app npx cap sync
App.addListener('appUrlOpen', data => { console.log('App opened with URL:', data); // not triggerring });
const checkAppLaunchUrl = async () => { const { url } = await App.getLaunchUrl();
console.log('App opened with URL: ' + url); // url always empty };
appUrlOpen event needs to fire and getLaunchUrl need to give deeplink Url
**Desktop - Windows
@IT-MikeS I appreciate your quick response