2012年8月25日 星期六
Migrating Your Apps
Migrating Your Apps
This section describes how to move existing C2DM apps to GCM.
Client changes
Migration is simple! The only change required in the application is replacing the email account passed in the sender parameter of the registration intent with the project ID generated when signing up for the new service. For example:Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER"); // sets the app name in the intent registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0)); registrationIntent.putExtra("sender", senderID); startService(registrationIntent);
After receiving a response from GCM, the registration ID obtained
must be sent to the application server. When doing this, the application
should indicate that it is sending a GCM registration ID so that the
server can distinguish it from existing C2DM registrations.
從GCM接收到響應後,所獲得的註冊ID必須被發送到應用程序服務器。在這樣做時,應用程序應該表明它已被發送一個GCM註冊ID,這樣服務器可以區分它從現有的C2DM註冊。
Server changes
When the application server receives a GCM registration ID, it should store it and mark it as such.Sending messages to GCM devices requires a few changes:
- The request should be sent to a new endpoint:
https://android.googleapis.com/gcm/send. - The Authorization header of the request should contain the API key generated during sign up. This key replaces the deprecated ClientLogin Auth token.
Content-Type:application/json Authorization:key=AIzaSyB-1uEai2WiUapxCs2Q0GZYzPu7Udno5aA { "registration_id" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...", "data" : { "Team" : "Portugal", "Score" : "3", "Player" : "Varela", }, }For a detailed discussion of this topic and more examples, see the Architectural Overview.
Eventually, once enough users of your application have migrated to the new service, you might want to take advantage of the new JSON-formatted requests that give access to the full set of features provided by GCM.
2012年8月24日 星期五
append()
append()
http://blog.xuite.net/x_3kkk/java/11386460-%E5%AD%97%E4%B8%B2%E7%9A%84%E6%96%B0%E5%A2%9E%E8%88%87%E6%8F%92%E5%85%A5+%28+append+%2F+insert+%29
http://blog.xuite.net/x_3kkk/java/11386460-%E5%AD%97%E4%B8%B2%E7%9A%84%E6%96%B0%E5%A2%9E%E8%88%87%E6%8F%92%E5%85%A5+%28+append+%2F+insert+%29
2012年8月17日 星期五
2012年8月15日 星期三
compile kernel error
out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
1. Install gcc4.4
apt-get gcc-4.4 and gcc-4.4-multilib and do
2. Use this command to build
make CC=gcc-4.4 CXX=g++-4.4
https://groups.google.com/forum/#!msg/android-building/GhtCJSBDwUw/WkKtUiNB_moJ[1-25]
out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt
https://groups.google.com/forum/#!msg/android-building/GhtCJSBDwUw/WkKtUiNB_moJ[1-25]
out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt
2012年8月8日 星期三
Java note
@link:
/**
*亂說一同
* @link package.class #getValue
* @param
* @see #getValue
*/ @link是一個連接標記,在doc裡會多增加一個See Also(默認的類是自己) #member label就是把@see獲取到。你可以試一下就明白了
http://topic.csdn.net/t/20031222/14/2589902.html
http://www.thebuzzmedia.com/supported-values-for-suppresswarnings/
public class GCMIntentService extends GCMBaseIntentService {
// @SuppressWarnings("hiding")
private static final String TAG = "GCMIntentService";
public GCMIntentService() {
super("SENDER_ID");
}
/**
*亂說一同
* @link package.class #getValue
* @param
* @see #getValue
*/ @link是一個連接標記,在doc裡會多增加一個See Also(默認的類是自己) #member label就是把@see獲取到。你可以試一下就明白了
http://topic.csdn.net/t/20031222/14/2589902.html
@SuppressWarnings
hiding to suppress warnings relative to locals that hide variable
java.lang.ObjectIntentService
com.google.android.gcm.GCMBaseIntentService
| Field Summary | |
|---|---|
static java.lang.String | TAG |
protected GCMBaseIntentService(String senderId) {
// name is used as base name for threads, etc.
super("GCMIntentService-" + senderId + "-" + (++sCounter));
mSenderId = senderId;
}
| Constructor Summary | |
|---|---|
protected | GCMBaseIntentService()
Constructor that does not set a sender id, useful when the sender id is context-specific. |
protected | GCMBaseIntentService(java.lang.String... senderIds)
Constructor used when the sender id(s) is fixed. |
2012年7月13日 星期五
Study English
set up 設定
receive 接收
proper 正確
simply 簡單地
It does not provide any built-in user interface or other handling for message data.
GCM simply passes raw message data received straight to the Android application,
GCM簡單地傳送原始訊息
simply 簡單地
It does not provide any built-in user interface or other handling for message data.
GCM simply passes raw message data received straight to the Android application,
GCM簡單地傳送原始訊息
訂閱:
文章 (Atom)