locked
Event triggering in a background task RRS feed

  • Question

  • Hi there!

    I'm fairly new to working with Windows Phone and I'm facing some difficulties.
    I'm making an app for which I've a background task which will be triggered whenever I enter a so called Geofence(thus the geofence trigger is set).
    As soon as I enter a geofence an event is raised which causes the backgroundtask to run and perform his actions, this background task will bring up a Toast Notification that redirects the user to a new XAML page.
    All of this works perfectly but I would want to add some functionality and that's what I'm having trouble with.

    When this event occurs(that being the geofence trigger) I would like to remove my visual presentation of the geofence on the map and start some other process but how would I do this?
    I've been thinking about using events but I'm not sure if you can actually register for an event that's present in the background task?

    Any advice/help?

    Thanks in advance!

    My best regards

    Jan

    Wednesday, March 18, 2015 10:13 AM

Answers

  • Background Tasks run in a separate process from your main App. The two share the same storage however - e.g. if your Task writes a file the App can consume it. You can't launch regular Apps from a background task and you can't really start other tasks from a Background Task.

    If it's all about removing a certain marker and doing some processing when the App runs after the geofence task has run I would suggest to either use URL parameters instructing the App to do so in the URL the Toast uses to launch the App or likely even better - to write a file with all the necessary information on what to do and reading the file in the main App when it is started the next time.

    Wednesday, March 18, 2015 1:48 PM