Skip to content

Instantly share code, notes, and snippets.

@knife-s
Created April 13, 2019 04:50
Show Gist options
  • Save knife-s/c0d557118cab891d19304c2060740c28 to your computer and use it in GitHub Desktop.
Save knife-s/c0d557118cab891d19304c2060740c28 to your computer and use it in GitHub Desktop.

Revisions

  1. knife-s created this gist Apr 13, 2019.
    1 change: 1 addition & 0 deletions infinite service android
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    3. Once, I tested how WhatsApp keeps its service running, so I turn off my internet and then force closed WhatsApp and waited for service to be restart. But service didn’t start. But when I turn on the internet service started. Then I realize that server (GCM) is communicating with the app. So you can restart your service by using Firebase. You can integrate firebase notification in your app and then send notification from firebase. This will start firebase service in your app and in that service you can restart your original service even if your app is forced closed. Method 1 and 2 will not work if your app is closed but this will. I’ll send you my code in leading mail(s). Really its very nice to hear from you. Happy to help!