当我从 GCM 获取新数据时,有人可以向我展示流程背后的层次结构吗?只发生在客户端的过程。示例:首先,数据进入 CommonUtilities 类中的 displayMessage 函数。秒数据传输到 GCMIntentService 类中的 onMessage 函数,以此类推。
谢谢!
private final BroadcastReceiver mHandleMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String newMessage = intent.getExtras().getString(EXTRA_MESSAGE);
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
// Showing received message
lblMessage.append(newMessage + "\n");
Toast.makeText(getApplicationContext(), "New Message: " + newMessage, Toast.LENGTH_LONG).show();
// Releasing wake lock
WakeLocker.release();
}
};