Giter Club home page Giter Club logo

Comments (13)

tsubik avatar tsubik commented on July 20, 2024

Only by receiveTransition event so far. Take a look here. It's not gonna work when your app is closed though.

from cordova-plugin-geofence.

dylanvdmerwe avatar dylanvdmerwe commented on July 20, 2024

There must be a way to get a customization action to execute when a geofence event happens though? Natively this can happen on both iOS and Android as far as I know.

from cordova-plugin-geofence.

jgcaruso avatar jgcaruso commented on July 20, 2024

I issued a pull request that was merged a few days ago that allows this for iOS. It uses NotificationCenter to send a message to anyone who is registered to listen to it. Check it out, there are details on how to implement it (Objective-c code only, but Swift shouldn't be too hard to figure out): #43

I'll be working on Android support for this in a little while.

from cordova-plugin-geofence.

tsubik avatar tsubik commented on July 20, 2024

Example how to do this in native code is here. I would say this is similar to #53 and #86.

from cordova-plugin-geofence.

johnrobertcobbold avatar johnrobertcobbold commented on July 20, 2024

This is already do-able with this plugin (at least on iOS, haven't started working on Android yet).

from cordova-plugin-geofence.

frmi avatar frmi commented on July 20, 2024

I have tested it on Android and it seems to work aswell without native code

from cordova-plugin-geofence.

rebebop avatar rebebop commented on July 20, 2024

@frmi Can you post your code? It isn't working form me. Also, the problem is not that it doesn't work at all but it doesn't work when your app is in background (for android).

from cordova-plugin-geofence.

frmi avatar frmi commented on July 20, 2024

@razagill i'm sorry, i was wrong this does not work if the app is forcefully closed, since the webview will be null.

from cordova-plugin-geofence.

johnrobertcobbold avatar johnrobertcobbold commented on July 20, 2024

@razagill "since the webview will be null" - is that the reason on Android ? When the app was forcefully closed, iOS re-opens the app on a geofence event and therefore recreates the webview .

from cordova-plugin-geofence.

rebebop avatar rebebop commented on July 20, 2024

@johnrobertcobbold Not exactly, you can't run javascript code in the background on android. So you have to modify the plugin and add new class that extends the BroadcastReceiver (details are on the main page of this plugin), I was able to catch the transitions in the background after this modification.

from cordova-plugin-geofence.

johnrobertcobbold avatar johnrobertcobbold commented on July 20, 2024

So basically like iOS using the new wkWebView... oh great :-/

from cordova-plugin-geofence.

frmi avatar frmi commented on July 20, 2024

@razagill @johnrobertcobbold The plugin is still alive even if you forcefully kill the app. The notification is successfully tiggered, but the onTransitionReceived callback cannot be executed since the cordova web view has been released by closing the app.
02-24 12:24:49.309 711-972/com.frmi.app D/GeofencePlugin﹕ Transition Event Received! 02-24 12:24:49.309 711-972/com.frmi.app D/GeofencePlugin﹕ Webview is null

I guess there is no way around the broadcast receiver for now.

from cordova-plugin-geofence.

Wade-BuildOtto avatar Wade-BuildOtto commented on July 20, 2024

their must be a method to call a custom url scheme, rather than setting up a notification, it seems like you have to setup everything you need to when you create the fence and the system takes over.

maybe use it in conjunction with https://github.com/EddyVerbruggen/Custom-URL-scheme
then capture the data from the url and execute the code.

from cordova-plugin-geofence.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.