locked
Xamarin Architectural Design RRS feed

  • Question

  • User296700 posted

    I've built a couple of small and insignificant applications and generally I'm comfortable with Xamarin development. That said, I am looking for some architectural guidance. I generally build utility type applications. I recently had a few ideas that all revolve around the same principal... The application would require two pieces... a user interface (typical Xamarin forms app), that stores settings, features, and data all of which can be stored in text files (json or xml), and the second piece, some sort of service layer that executes continuously and is affected by those same files.

    Simple case, I have a user interface app with an instructions page, and a settings page that contains settings to start, stop and configure the service. The service could be started or stopped by the user in the interface. It could be reconfigured, and restarted when needed. And If the user exits the app with the service running, it would continue to run in the background... I've been dabbling with "BroadcastReceivers" and since these are placed in the Android project, and typically run on the primary and only activity, would these not stop running if the app were exited or backgrounded? I'm seeking guidance from someone with a higher level of experience than I currently possess...

    Thanks to all in advance,

    SB

    Friday, January 15, 2021 8:50 AM

All replies

  • User379860 posted

    would these not stop running if the app were exited or backgrounded?

    For Android

    If your application in the backgroud, you can use foreground service , You can running your task in the foreground service. it will executed and keep your application always alive.

    https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/services/foreground-services

    If your application was exited, all of your services(No matter foreground or background service) will be removed in this RAM, your service will be stopped.

    For iOS

    No application could awalys running background except these type of application. it will be killed within 600 seconds.


    Xamarin forums are migrating to a new home on Microsoft Q&A! We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A! For more information, please refer to this sticky post.

    Friday, January 15, 2021 11:31 AM