GcmTaskService not working
<p>I want to replace my BroadcastReceiver in my project to GcmNetworkManager. So I read some tutorials and do like that:<br>
1) In manifest I add:</p>

<pre><code>&lt;service android:name=".WakeOnLanService"
      android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"
        android:exported="true"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.google.android.gms.gcm.ACTION_TASK_READY"/&gt;
        &lt;/intent-filter&gt;
    &lt;/service&gt;  
</code></pre>

<p>2) Service:</p>

<pre><code>public class WakeOnLanService extends GcmTaskService {

@Override
public int onRunTask(TaskParams taskParams) {
    return GcmNetworkManager.RESULT_SUCCESS;
}

@Override
public int onStartCommand(Intent intent, int i, int i1) {
    Toast.makeText(this,"Выполнилось",Toast.LENGTH_SHORT).show();
    return super.onStartCommand(intent, i, i1);
}
}
</code></pre>

<p>3) Schedule in activity:</p>

<pre><code>public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    GcmNetworkManager mGcmNetworkManager = GcmNetworkManager.getInstance(this);
    Task task = new OneoffTask.Builder()
            .setService(WakeOnLanService.class)
            .setExecutionWindow(0, 2)
            .setTag("MyTag")
            .setUpdateCurrent(true)
            .setRequiredNetwork(Task.NETWORK_STATE_CONNECTED)
            .setRequiresCharging(false)
            .build();
    mGcmNetworkManager.schedule(task);
}
}
</code></pre>

<p>But it is not work, Toast not shown. How to do it correct and what is the best practice to run the Service with GcmNetworkManager on internet connect, like it was in Broadcast Receiver?</p>