Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Capacitor Support #407

Closed
EinfachHans opened this issue Aug 5, 2020 · 4 comments
Closed

feat: Capacitor Support #407

EinfachHans opened this issue Aug 5, 2020 · 4 comments
Labels
feature request New feature or request wontfix

Comments

@EinfachHans
Copy link

Feature request

I want to switch to Capacitor with my Apps and in nearly every App i used this Plugin. What would be needed to add official Support for Capacitor? I think the main Problem is that the Hooks don't work in Capacitor why the enabling/disabling of Modules doesn't work?

Maybe create a Support Plan to finance your work on this like the official Cordova Google Maps Plugin?

@dpa99c dpa99c added the feature request New feature or request label Aug 7, 2020
@KiranUppunda
Copy link

KiranUppunda commented Oct 19, 2020

@EinfachHans , were you able to add this with capacitor ? I am trying to integrate diagnostic with capacitor, but app is getting crashed.

This is the error,

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null point reference

@sertal70
Copy link

sertal70 commented Nov 6, 2020

Hi all,
I've been able to install and run the plugin in a Ionic+Capacitor project, simply following these steps:

  1. create the config.xml file on the root of the Ionic project containing your needed permissions:
<?xml version='1.0' encoding='utf-8'?>
<widget id="my.beautiful.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <preference name="cordova.plugins.diagnostic.modules" value="LOCATION NOTIFICATIONS <etc>" />
</widget>
  1. install the plugin:
    npm i cordova.plugins.diagnostic --save

  2. sync platform projects
    npx cap sync

That's all. I've tested it on both Android and iOS, works fine.

@raykin
Copy link

raykin commented Dec 9, 2020

I try several different ways to apply the plugin with Capacitor. I got several conclusions.

  1. Can't use it with @ionic-native/diagnostic. It just has compile error even function doesn't called at all. I doesn't inject service into root, so compile error only happened when related service is loaded.
    Here is the code snippet
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
@Injectable()
export class QueryLocationService {

I have such error in Xcode console.

⚡️  [error] - resolvePromise@capacitor://localhost/polyfills.js:3425:48 [angular]
resolvePromise@capacitor://localhost/polyfills.js:3377:35 [angular]
capacitor://localhost/polyfills.js:3487:35 [angular]
onInvokeTask@capacitor://localhost/vendor.js:86707:43 [angular]
drainMicroTaskQueue@capacitor://localhost/polyfills.js:3196:46 [<root>]
invokeTask@capacitor://localhost/polyfills.js:3111:44 [<root>]
invokeTask@capacitor://localhost/polyfills.js:4248:24 [<root>]
globalZoneAwareCallback@capacitor://localhost/polyfills.js:4274:31 [<root>]
  1. Can work with Capacitor. I only test one function.
  requestPermission() {
    return new Promise((resolve, reject) => {
      (<any>window).cordova.plugins.diagnostic.isLocationAuthorized((res) => {
        console.debug("cordova.plugins.diagnostic.isLocationAuthorized ==>")
        console.debug(res);
        resolve(res);
      }, (err) => {
        reject(err);
      })
    })
  }
  1. Capacitor doesn't read config.xml at all. So I don't know where to config single module.

@stale
Copy link

stale bot commented May 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 12, 2021
@stale stale bot closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request wontfix
Projects
None yet
Development

No branches or pull requests

5 participants