こんにちは〜私はアンドロイドの初心者です。 そして私は...私のコードはここにGoogleのシンプルなC2DMコード... を使用してregisteration IDを取得しようとエミュレータでc2dmを使用して登録IDを取得
Intent registrationIntent = new Intent ("com.google.android.c2dm.intent.REGISTER");
registrationIntent.setPackage("com.imei"); //"com.imei"
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent (), 0));
registrationIntent.putExtra("sender", "[email protected]");
Log.d("WelcomeScreen","[email protected]");
TextView textview = (TextView)this.findViewById(R.id.textview);
textview.setText("The Show Start...");
Button mbutton = (Button)this.findViewById(R.id.button); //set a button to jump
mbutton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
System.out.println("adds"); //just for check
startService(registrationIntent);
Intent intent = new Intent(imei.this, showthinga.class);
startActivity(intent);
handleRegistration(getApplicationContext(), registrationIntent);
System.out.println("end"); //just for check
}
});
}
private void handleRegistration(Context context, Intent intent)
{
文字列の登録= intent.getStringExtra( "REGISTRATION_ID");
if(intent.getStringExtra( "error")!= null) {
//登録に失敗しました。 Log.e( "ERROR"、 "ERROR");
} else if(intent.getStringExtra( "unregistered")!= null){
//登録解除が完了した場合、承認された送信者からの新しいメッセージは拒否されます Log.e( "unregistered"、 "unregistered");
} else if(registration!= null) {
//メッセージを送信しているサードパーティのサイトに登録IDを送信します。
//これは別のスレッドで行う必要があります。
//完了したら、すべての登録が完了したことに注意してください。
Log.e( "登録"、登録)。
}
毎回 }
}
しかし、私は私のlogcatメッセージ... を見てみるとそれは常に示しています... サービスの意図{行為= com.google.android.c2dmを開始することができません。」 「私はGoogleの「Google Inc、Android API8、リビジョン2」に私のavdを更新しました... それでもまだ動作していません&メッセージが常に表示される... ...私が逃したものは何か、間違っていたものはありますか?