Forum Visual Studio

How to configure app for running a Service

I wrote an app that was written for Windows phone that checks for "new data" (info the user hasnt seen yet) in a background process by making a web call, and then updates the tile when new info is found. I'm converting it to Xamarin and have created a service that makes a call to the app to look for new data and then displays a notification. This works, however, when the app sleeps so does the background process. The "Running Services" on the device shows the app and service is running, but the notifications stop, so I dont think it is. I've tried to get the service to run in a separate process but that errors at start up (perhaps due to this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=51940).

So, either the bug is stopping me from moving forward, or I don't have my service setup correctly, or I need to reconfigure my app so that getting data is in a separate dll that both the main app and the background service will reference. The last option would be difficult since the I need info from the application settings to know how to look for new data.

Any ideas what I'm missing?

Pete

Posts

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @PeterZiminski,

    I've not extensively worked on the background services, however, sure that you can do a fair amount of work using Xamarin.

    The article above shows some basic examples, see if that helps.

    As far as the 'infinite running process' is if your concern, I guess no modern devices (i mean with latest OS) would permit them. Also user has a choice to remove such process(es) with software like Clean Master or Advanced Task Killer.

    • N Baua
  • PeterZiminskiPeterZiminski USMember ✭✭

    It was option 2... my service was not setup correctly:

    instead of return StartCommandResult.Sticky;

    return StartCommandResult.RedeliverIntent;

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @PeterZiminski ,

    Glad to hear that, please mark your post as an answer. (optionally mark the earlier post as well, since it contains the URL)

    N Baua

Sign In or Register to comment.