Endless background service

Dimitris Christoforidis 301 Reputation points
2021-10-11T12:55:48.37+00:00

Hello developers, i want to create a chat application. I need when a new message will be received, to notify user by using a local notification. I also need to look for new messages even when applicaiton is totally closed.

Is there any method which i can do that? Do i need to create an endless background service? Is there any other way?

Thank you

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,369 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 78,431 Reputation points Microsoft Vendor
    2021-10-12T07:06:21.1+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    I also need to look for new messages even when applicaiton is totally closed.Is there any method which i can do that? Do i need to create an endless background > service? Is there any other way?

    For Android, if you have background service, it will be closed in Android will grant the app a certain amount of time(Nearly 10 minutes) to start and use services. Once that time has elapsed, the app can no longer start any services and any services that were started will be terminated. Due to the Background Execution Limits in Android 8.0.

    For iOS, background task typically get about 600 seconds (10 minutes) of processing time after an application has moved to the background on iOS 6, and less than 10 minutes on iOS 7+

    You can try to use FCM to make a test. - Handled by the client app. These messages trigger the onMessageReceived() callback even if your app is in foreground/background/killed.

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.