Yes, itβs true that you have one google login id for the application on the device.
But you can always register and unregister users on their own server who will send messages to GCM, and GCM will send them to registered devices.
Define some interfaces for your server, such as registerOnServer and unRegisteronServer, send a unique value for each user in this interface.
So, in your case, when A uses Log ins, registration is first performed on GCM and registers the user on your server using the registerOnServer interface, and when the user registers in the sending notifications related to him, the GCM is sent to the device.
When A logs out, unregister with unRegisterServer and do not send any messages from your server to GCM, since A is not registered.
So now, if B registers even with the same device, register it on your server and send its messages.
This will solve your problem!
source share