service never close

AndersonNoletoAndersonNoleto USMember ✭✭✭

Hi, how to do a server with never close? I need a service with never close.

Answers

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @AndersonNoleto
    You should write more to your problem (what exactly are you trying to do) .
    What do you mean with "a server" (real server = web service)?
    What do you mean with "a service that never close"?
    Then - maybe - somebody can help you...

  • AndersonNoletoAndersonNoleto USMember ✭✭✭
    > @FredyWenger said:
    > @AndersonNoleto
    > You should write more to your problem (what exactly are you trying to do) .
    > What do you mean with "a server" (real server = web service)?
    > What do you mean with "a service that never close"?
    > Then - maybe - somebody can help you...

    I need create one service background on android with never close
  • GuyProvostGuyProvost CAMember ✭✭✭

    @AndersonNoleto First you should post this question in the Android section, cause it seems like a specific Android problems. And then some code of your service should be shared if you want us to peek at it and give it a shot!

    Still... I dont know if...

    1) You want to create a background service in Android that never closes ? (wich is impossible... It WILL close at some point, if Android decides that resources are so scarce and need to reclaim them, your sercice will go down... You have to be prepared to this event! But you can make it sticky in order for Android to restart it)

    Or

    2) Or you need to know how to close a service on Android

  • AndersonNoletoAndersonNoleto USMember ✭✭✭
    > @FredyWenger said:
    > @AndersonNoleto
    > You should write more to your problem (what exactly are you trying to do) .
    > What do you mean with "a server" (real server = web service)?
    > What do you mean with "a service that never close"?
    > Then - maybe - somebody can help you...

    I need create one service background on android with never close > @GuyProvost said:
    > @AndersonNoleto First you should post this question in the Android section, cause it seems like a specific Android problems. And then some code of your service should be shared if you want us to peek at it and give it a shot!
    >
    > Still... I dont know if...
    >
    > 1) You want to create a background service in Android that never closes ? (wich is impossible... It WILL close at some point, if Android decides that resources are so scarce and need to reclaim them, your sercice will go down... You have to be prepared to this event! But you can make it sticky in order for Android to restart it)
    >
    > Or
    >
    > 2) Or you need to know how to close a service on Android

    Hi @GuyProvost ,
    The facebook receive messages with app closed. How to receive messages with app closed?
  • GuyProvostGuyProvost CAMember ✭✭✭

    Hey there @AndersonNoleto , by message do you mean notifications ? Like facebook does when you set the settings to allow notification ?

    If so, receiving notification when app is closed is what you want to achieve, you need two things, a service and use the Notification API. This is a topic in itself, better start with the start I think. Read about notification here :smile:

    Official docs : https://developer.android.com/guide/topics/ui/notifiers/notifications.html

    Notification ServiceListener : https://developer.xamarin.com/api/type/Android.Service.Notification.NotificationListenerService/

    Notification concepts with Xamarin.Android : https://developer.xamarin.com/guides/android/application_fundamentals/notifications/

    If you want to read about doing this kinda stuff using Java, easily adaptable : stackoverflow.com/questions/13741875/how-to-get-android-notifications-when-app-was-closed

    Happy learning!

Sign In or Register to comment.