1
다음 코드를 사용하여 Android 장치에 장치 토큰을 가져 왔습니다. 하지만 첫 번째 시도에 null 값이 표시됩니다. 여기 장치 토큰이 처음으로 null을 반환합니다.
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, UtilsGcm.GCMSenderId);
}
내가 그 Gona을이 운동 날씨 여부 어쨌든 한번 시도해 .... 나를 당신의 GCM 클래스 검사에서 을 알려 몰라
public class GCMIntentService extends GCMBaseIntentService {
public GCMIntentService() {
super(UtilsGcm.GCMSenderId);
}
@Override
protected void onError(Context context, String regId) {
Log.e("", "error registration id : " + regId);
}
@Override
protected void onMessage(Context context, Intent intent) {
handleMessage(context, intent);
}
@Override
protected void onRegistered(Context context, String regId) {
System.out.println("on registered" + regId);
UtilsGcm.registrationId = regId;
handleRegistration(context, regId);
}
@Override
protected void onUnregistered(Context arg0, String arg1) {
}
}
문제는 null을 반환하기 전에 멀리 이동하려고하면 장치 ID를 생성하는 데 시간이 걸리므로 gcm 클래스도 게시 해주세요. –
@George : edited –