Closed dylanvdmerwe closed 4 years ago
Why do you want to use this plugin with Capacitor? Are you building a PWA app?
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.
This plugin is a pure Cordova plugin. It cannot be used without Cordova.
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:
if a capacitor-background-geolocation plugin
No. Use plain old Ionic.
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.
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.
@dylanvdmerwe Just stick with pure Ionic for now.
I created a Hello World Cap app and added cordova-background-geolocation-lt
. It works for both iOS and Android.
Android
iOS
Android Setup:
android/build.gradle
:
allprojects {
repositories {
**iOS**
Info.plist
I'm skeptical of the long term for Ionic (and Capacitor): Flutter vs Ionic vs React Native
@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!
@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.
android/build.gradle
:
buildscript {
ext { // <-- globally defined var for use by plugin devs and user's app.
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
.
.
.
}
android/app/build.gradle
android {
// Please do not hard-code these: fetch from ext instead.
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
.
.
.
}
// Default dependencies use ext vars as well. dependencies { . . . implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" }
@christocracy thanks for taking a look and for the good feedback. Will look into this with @jcesarmobile and see what we can do!
@mlynch And I hope Capacitor has a plan for supporting AndroidX
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.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
@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>```
Capacitor support is implemented in the Private repo currently.
(Please don’t post your key to the public)
@christocracy can you please share with me so i can integrate and research on it.
@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
@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;
Same usage like ionic3?
No. The plugin has had Typescript support for ages.
@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.
Any idea when the Capacitor functionality will be released publicly?
Typically every 3 months.
Just use the private repo.
@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";
@bhandaribhumin If you get that error while using the private repo, post an issue in the private repo.
@christocracy okay thanks
Capacitor support is published to 3.2.2. See the README for setup instructions.
I just wanted to inquire if on your roadmap there is any chance that Capacitor will be supported by this plugin in the future?