title: Android Oreo battery optimization causes delays in FCM
body: <p>I have implemented the FCM exactly like documentation of if says:</p>
  
  <p>I have a service like this 
  <code>public class TCMessagingService extends FirebaseMessagingService</code> </p>
  
  <p>And I have declared it in manifest like so:</p>
  
  <pre><code>&lt;service android:name=".services.TCMessagingService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
              &lt;/intent-filter&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>I target and compile with SDK level 25, and my firebase version is 10.2.1.</p>
  
  <p>Now the problem is that on Android 8.0 sometimes I have huge delays when I receive push notifications. it can come after a few minutes. But this is not always so, sometimes things work just like expected, push notifications came very quickly.</p>
  
  <p>I tried to update the FCM version to the last one but that did not help.</p>
  
  <p>But when in the settings I turn off the battery optimization for my app everything works fine. But this is not a solution. 
  What can I do to make FCM work as expected on Android 8.0?</p>