Giter Club home page Giter Club logo

Comments (4)

wallstudios avatar wallstudios commented on August 21, 2024

I've managed to get this working.
in xcode you needed to manually tell the app to run in background mode for locations and notifications.

if you update the following to the plugin.xml file it will add it in automatically.

i've added

            <config-file target="*-Info.plist" parent="UIBackgroundModes">
                <array>
                    <string>location</string>
                    <string>remote-notification</string>
                </array>
            </config-file>

into here

        <!-- ios -->
        <platform name="ios">
            <hook type="after_plugin_install" src="hooks/add_swift_support.js" />
            <config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
                <string>${EXECUTABLE_NAME} Would Like to Use Your Current Location Even In Background.</string>
            </config-file>
            <config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
                <string>${EXECUTABLE_NAME} Would Like to Use Your Current Location When In Use.</string>
            </config-file>
            <config-file target="*-Info.plist" parent="UIBackgroundModes">
                <array>
                    <string>location</string>
                    <string>remote-notification</string>
                </array>
            </config-file>      
            <config-file target="config.xml" parent="/*">
              <feature name="GeofencePlugin">
                <param name="ios-package" value="HWPGeofencePlugin"/>
              </feature>
            </config-file>
            <header-file src="src/ios/Geo-Bridging-Header.h" />
            <source-file src="src/ios/GeofencePlugin.swift"/>
            <source-file src="src/ios/SwiftData.swift"/>
            <source-file src="src/ios/json.swift"/>
        </platform>

from cordova-plugin-geofence.

wallstudios avatar wallstudios commented on August 21, 2024

one more addition...

in GeofencePlugin.swift I've added in the default sound to the notification.
I've also added Badge numbers as well but haven't figured out how to clear them from the app yet.

        func notifyAbout(geo: JSON) {
            log("Creating notification")
            var notification = UILocalNotification()
            notification.timeZone = NSTimeZone.defaultTimeZone()
            var dateTime = NSDate()
            notification.fireDate = dateTime
            notification.soundName = UILocalNotificationDefaultSoundName;
            //notification.applicationIconBadgeNumber = 1;
            notification.alertBody = geo["notification"]["text"].asString!
            UIApplication.sharedApplication().scheduleLocalNotification(notification)
        }

from cordova-plugin-geofence.

pedroabreu avatar pedroabreu commented on August 21, 2024

Nice work @wallstudios, can you make a PR with those changes ?

from cordova-plugin-geofence.

tsubik avatar tsubik commented on August 21, 2024

I've applied those changes. Thanks!

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.