0
是不是不行了C2DM在我的啓動畫面註冊?我可以在我的閃屏中註冊C2DM(推送通知)嗎?
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
public class myMain extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.isplash);
MediaPlayer mpSplash = MediaPlayer.create(this, R.raw.musicsplash);
mpSplash.start();
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
registrationIntent.putExtra("sender", "my email address");
startService(registrationIntent);
Thread logoTimer = new Thread(){
public void run(){
try{
sleep(4000);
startActivity(new Intent("com.ishop.pizzaoven.CLEARSCREEN"));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
}
如果谷歌刷新會發生什麼你註冊號碼? 從http://code.google.com/android/c2dm/#handling_reg引 「谷歌可以週期性地刷新該接收機ID」 –
的初始屏幕的請求註冊ID,但C2DM接收機將處理響應。它將以相同的方式處理該註冊ID的任何更新更新(例如,如果它改變)。問題是關於首先請求它的地方。 –