transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

Capacitor support #937

Closed dylanvdmerwe closed 4 years ago

dylanvdmerwe commented 4 years ago

I just wanted to inquire if on your roadmap there is any chance that Capacitor will be supported by this plugin in the future?

christocracy commented 4 years ago

Why do you want to use this plugin with Capacitor? Are you building a PWA app?

dylanvdmerwe commented 4 years ago

Hi @christocracy

No not from a PWA perspective. Capacitor will be Ionic's preferred way of integrating with native platforms (iOS and Android). As such, this will be a replacement for the cordova layer.

I would then assume there is a Capacitor version of your plugin (for iOS and Android) using the exact native code you have without the cordova layer.

christocracy commented 4 years ago

This plugin is a pure Cordova plugin. It cannot be used without Cordova.

dylanvdmerwe commented 4 years ago

Sorry let me clarify. I understand that this plugin is for Cordova only. I posted this query on this repo because I know many people (and myself included) have used this plugin in their Cordova projects - but as Capacitor is out we are planning a migration path from Cordova to Capacitor and this is a checkbox on the migration list.

As such, I was querying if a capacitor-background-geolocation plugin is on your horizon at all that exposes the functionality we love from the Cordova one? :smile:

christocracy commented 4 years ago

if a capacitor-background-geolocation plugin

No. Use plain old Ionic.

christocracy commented 4 years ago

Capacitor is for people making PWA apps, apps that run purely in a webview with no need to be released through app stores. These apps have no access to native APIs.

BackgroundGeolocation, of course, makes heavy use of native apis (Location, Geofencing, Accelerometer, Gyroscope, Magnetometer, SQLite, HTTP).

Capacitor contains Ionic. You need only stick to using pure Ionic.

jcesarmobile commented 4 years ago

Just to clarify, Capacitor is a Cordova alternative, and can be used with and without Ionic. It's not PWA only, it can be used to create native and hybrid apps. It has its own set of native plugins and also has Cordova plugin support (not all of them work, but most).

I have not tried your plugin with Capacitor, but if it doesn't work and somebody report the problem with details, we will try our best to make it compatible. In case it's not possible on our end, then the only way might be to have a separate capacitor plugin.

christocracy commented 4 years ago

@dylanvdmerwe Just stick with pure Ionic for now.

christocracy commented 4 years ago

I created a Hello World Cap app and added cordova-background-geolocation-lt. It works for both iOS and Android.

Android

iOS

christocracy commented 4 years ago

Android Setup:

christocracy commented 4 years ago

The manual setup instructions are similar to React Native's manual setup instructions for Android and iOS

christocracy commented 4 years ago

I'm skeptical of the long term for Ionic (and Capacitor): Flutter vs Ionic vs React Native

mlynch commented 4 years ago

@christocracy wouldn't count us out yet. Until this Spring you could only use Ionic with Angular, which was a big limiting factor in our growth. We're about to roll out official React and Vue support soon which will change everything.

In fact, our most recent community numbers are higher than they've ever been now that we're starting to expand into those other communities, and now that Capacitor is here to improve the Cordova experience that pushed a lot of people away.

Ionic brings some fundamental advantages that React Native and Flutter don't, namely a pure web development experience that also works on mobile, desktop, and web (PWAs). While Flutter claims to do the latter, Flutter for Web is more like Flash than like a true web development framework, so I wouldn't even count that as true web support.

I imagine the desktop and web stuff doesn't matter to you but hope it helps frame things.

Also, we're doing an increasing amount of enterprise business (i.e. real money!) with large teams that can't just do mobile, so many other frameworks aren't an option for them. I imagine many of them are using your plugins. Maybe there's a way to work more closely there.

We appreciate you supporting the Cordova side of many an Ionic app and hope you continue to do so!

christocracy commented 4 years ago

@mlynch I'll keep my eye on it. I've looked at the Capacitor Plugin API this morning and generated a HelloWorld plugin. I get it. I can see it'll take a couple of weeks to port a pure Capacitor version of cordova-background-geoleolocation and cordova-plugin-background-fetch, which would be preferable since it'll have better dependency control, particularly for Android.

This isn't the right place to mention this, but I hope Capacitor will modify its application template to append an ext block for global config parameters like React Native does. This makes life much easier for plugin developers solving Android dependency conflicts.

// Default dependencies use ext vars as well. dependencies { . . . implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" }

mlynch commented 4 years ago

@christocracy thanks for taking a look and for the good feedback. Will look into this with @jcesarmobile and see what we can do!

christocracy commented 4 years ago

@mlynch And I hope Capacitor has a plan for supporting AndroidX

stale[bot] commented 4 years ago

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. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.

bhandaribhumin commented 4 years ago

@christocracy can you give me details how to add my license like cordova in capacitor, and also help me with how to use this plugin in ionic 4 and capacitor.


  <config-file parent="/manifest/application" target="app/src/main/AndroidManifest.xml">
    <meta-data android:name="com.transistorsoft.xyzz_key" android:value="xyzxyzxanyanyanyanyany" />
    </config-file>
</platform>```
christocracy commented 4 years ago

Capacitor support is implemented in the Private repo currently.

(Please don’t post your key to the public)

bhandaribhumin commented 4 years ago

@christocracy can you please share with me so i can integrate and research on it.

christocracy commented 4 years ago

@bhandaribhumin Capacitor support exists in the private repo. If you have purchased a license key, you should have access to the private repo. Talk to the person who ordered the product: they can provide you access to the private repo via the Product Dashboard.

It seems you do not have access to the private repo. If you don't, the following url will be 404 for you: https://github.com/transistorsoft/cordova-background-geolocation

bhandaribhumin commented 4 years ago

@christocracy thanks for your advice I’m going to talk to my admin regarding this also I need your help for usage? Now I’m able to access private repo thanks but how to use this plugin in ionic4 capacitor?

Same usage like ionic3? Like

this._bgGeo= (window).BackgroundGeolocation;

christocracy commented 4 years ago

Same usage like ionic3?

No. The plugin has had Typescript support for ages.

pbramel commented 4 years ago

@christocracy Any idea when the Capacitor functionality will be released publicly? We are working with the private build and after a few hiccups, it seems to be functioning.

christocracy commented 4 years ago

Any idea when the Capacitor functionality will be released publicly?

Typically every 3 months.

christocracy commented 4 years ago

Just use the private repo.

bhandaribhumin commented 4 years ago

@christocracy Getting error Cannot find module 'cordova-background-geolocation'

ERROR in src/app/services/campus-map/background-geo-location.service.ts:10:8 - error TS2307: Cannot find module 'cordova-background-geolocation'.
[ng] 10 } from "cordova-background-geolocation";

Screen Shot 2019-09-16 at 4 18 31 PM

christocracy commented 4 years ago

@bhandaribhumin If you get that error while using the private repo, post an issue in the private repo.

bhandaribhumin commented 4 years ago

@christocracy okay thanks

christocracy commented 4 years ago

Capacitor support is published to 3.2.2. See the README for setup instructions.