我跟隨this example爲GCM工作正常只是告訴我如何服務器發送消息到每個註冊設備如何將唯一標識每個設備的機制。我SENDER_ID
是什麼regId
如何服務器唯一識別我的設備PHP服務器如何發送消息到多個設備,而無需SMS電子郵件服務告訴我它的機制,請將如何在這個應用程序的工作 我很少有這樣如何GCM服務器註冊ID和什麼是發送消息的機制
String SENDER_ID = "748495904142"
我從https://code.google.com/apis/console/?pli=1#project:748495904142:access
final String regId = GCMRegistrar.getRegistrationId(this);
// Check if regid already presents
if (regId.equals("")) {
// Registration is not present, register now with GCM
GCMRegistrar.register(this, SENDER_ID);
} else {
// Device is already registered on GCM
if (GCMRegistrar.isRegisteredOnServer(this)) {
// Skips registration.
Toast.makeText(getApplicationContext(),"Already registered with GCM",
Toast.LENGTH_LONG).show();
} else {
// Try to register again, but not in the UI thread.
// It's also necessary to cancel the thread onDestroy(),
// hence the use of AsyncTask instead of a raw thread.
final Context context = this;
mRegisterTask = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
// Register on our server
// On server creates a new user
ServerUtilities.register(context, name, email, regId);
return null;
}
@Override
protected void onPostExecute(Void result) {
mRegisterTask = null;
}
};
}
}
應用程序運行完美我只是想知道什麼是後端什麼是SENDER_ID什麼是regId如何php服務器消息到每個設備 – user2806157