I would assume it is quite a common task to handle cloud messages even when the device is sleeping and prevent it from going to sleep mode before handling the the message is finished.
No. That's
battery murder on long tasks. I remove such software immediately.
That said: write your software such that it can
resume and
recover. And take care about server-
and client side.
What you suggest is the completely wrong approach. I hope it is not by design....
Serious software development can not be done on a shoestring.