OK, I have found the solution myself. The problem was with registration to the GCM service.
I used code for registration from the GCM guide (https://developers.google.com/cloud-messaging/android/start):
public class RegistrationIntentService extends IntentService {
@Override
public void onHandleIntent(Intent intent) {
// ...
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
// ...
}
}
Actually it was working good. In Android and Knox the token was received as expected. But on Knox was no any message from GCM. After reviewing various apps I used different code for registration:
public class RegistrationIntentService extends IntentService {
@Override
public void onHandleIntent(Intent intent) {
// ...
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
String token = gcm.register(getString(R.string.gcm_defaultSenderId));
// ...
}
}
... and magically that was it. Hope it will be useful for somebody.