I am working on an IONIC Application which is showing service provider active location on google map with destination as user (lat,lon) and source as service provider active location (lat,lon).
Once service provider presses a button we are taking his location with "ionic cordova plugin add #mauron85/cordova-plugin-background-geolocation" plugin to take service provider location after 30 seconds.
It works when APP is in foreground, but it fails when app is being in-active or in back order.
I also used "ionic cordova plugin add cordova-plugin-background-mode" to enable the background process if it is required. But still the issue is persists.
I am not able to take service provider location if APP is in background.
Code i placed in constructor as below:
this.backgroundGeolocation.configure(this.config).then(() =>
{
this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) =>
{
this.latitude = String(location.latitude);
this.longitude = String(location.longitude);
this.saveCordinates();
});
});
after every 30 seconds i use
this.backgroundGeolocation.start();
which initialise fills this.latitude, this.longitude and then i am saving them with this.saveCordinates(); function
I also tried using that plugin and failed. After many hours of debugging I gave up and used another plugin.
I recommend using this one if you use Capacitor. It works perfectly on Android and iOS. For Cordova I heard this one is good, but I did not use it, so I am not sure.
Related
I have created an app on all 3 platforms: iOS, Android and Web. I also have manifest.json and other things required for PWA. I have deployed it to firebase hosting. Now what I want to do is manually trigger the Add to Home screen on tap of a button. The real problem is though all the articles shows code to be paste on JS side while I have all the UI in dart so How do I listen for beforeinstallprompt and trigger add to home screen manually ? I'm struggling with this from last 3 days but no luck. I have this package installed universal_html: ^1.2.3. If anyone knows how to do this please help me out.
What about writing those code in normal JavaScript, and then call it from Dart(flutter web).
There are many resources about that. For example, Flutter Web : How to run javascript using dart js
In addition, do not forget that, when you are writing Flutter web, you have the full control over the HTML/JS/CSS/Dart. Thus nothing can stop you from writing JS code :)
I'm using Ionic v4 to create an app that is able to receive notifications (by topic) by using the cordova-plugin-fcm-with-dependency-updated plugin.
At this moment everything works as supposed on IOS. I receive a notification and when I click on it, the onNotification event gets triggered and it redirects me to the app, on the page that I selected.
However, Android does not work like that. I would expect the same behavior as mentioned above, but for some reason the app is openend, but the onNotification event does not get triggered. I had some console.logs and alert placed inside, but none of them showed.
I then read the I had to add the click_send parameter to the notification body, with value FCM_PLUGIN_ACTIVITY.
Now this will give me an even more strange behavior: I do receive the notification, but clicking on it, will not even open the app! Also nothing in the logs...
Can anybody help me out here, I'm getting lost!
PS. just updated every npm package to #latest...
Apparently, all that had to be done was:
ionic cordova platform remove android
and:
ionic cordova platform add android
to refresh things.
Now everything works as expected...
I want to show a custom popup message whenever the user disconnects a cellular call. The problem is how to detect when the app is not running. any leads would be helpful.
It's been a while and there have been many developments.
First, there are some answers at How to create a service in Flutter to make an app to run always in background?
Also, flutter/Background processes will basically point you to medium/Executing Dart in the Background with Flutter Plugins and Geofencing (Sept 2018)
which is a Geofencing sample that involves a partnership between isolates, native Android/iOS code via MethodChannel, and PluginUtilities.getCallbackHandle (PluginUtilities)
Alas, there are many plugins available now:
https://pub.dev/packages/background_location
https://pub.dev/packages/android_alarm_manager (Android)
https://pub.dev/packages/background_fetch
https://pub.dev/packages/workmanager
https://pub.dev/packages/audio_service
I am new to Mobile development and I am using Ionic Native. I want to trigger a function at a fixed time point, e.g. every 12:00 pm on Friday, no matter my App is running or not.
I guess I need to register this function into the system service level but have no idea how to achieve this. I currently run my App on Android but maybe IOS later. I assume the solution will be different.
First: ionic is a css and angular directive and services framework binding your app with Cordova framework. As general rule of thumb if something is unrelated on how your app look or feel it is Cordova related issue
Second: It is not currently possible to keep running a code in background if the user kill your app in IOS.
if you want to run a background services in Andorid you can look at this
If you want to push a notification you can add Cordova(or ngCordova) plugin for local notificationhere. you can read
I want to make an hybrid app that shows me live my location. I'm using ionic and ngCordova geolocation plugin.To see if my location is changed,they have a function with $watch that can detect if location has been changed. I've run their code.It takes my location ,but it can't watch.Does anybody knows something about this?