我尝试将Google GAE作为GCM服务器运行,基于Google示例GCM演示项目,将Android作为客户端link。我的问题是Android java类CommonUtilities中应该声明的Server_URL是什么?来源如下。我已经注册了GAE申请表。我的Android应用程序正在运行,并且已经注册到GCM服务。但它无法将设备注册到我的GAE应用程序(最初的Demo服务器)。任何提示都非常受欢迎。感谢。
public final class CommonUtilities {
/**
* Base URL of the Demo Server (such as http://my_host:8080/gcm-demo)
*/
static final String SERVER_URL = null;
/**
* Google API project id registered to use GCM.
*/
static final String SENDER_ID = "my project number is here";
static final String TAG = "GCMDemo";
/**
* Intent used to display a message in the screen.
*/
static final String DISPLAY_MESSAGE_ACTION =
"com.google.android.gcm.demo.app.DISPLAY_MESSAGE";
/**
* Intent's extra that contains the message to be displayed.
*/
static final String EXTRA_MESSAGE = "message";
/**
* Notifies UI to display a message.
* <p>
* This method is defined in the common helper because it's used both by
* the UI and the background service.
*
* @param context application's context.
* @param message message to be displayed.
*/
static void displayMessage(Context context, String message) {
Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
intent.putExtra(EXTRA_MESSAGE, message);
context.sendBroadcast(intent);
}
}
答案 0 :(得分:1)
如果您的网络应用程序托管在Google App Engine上,它通常包含项目的项目ID。它通常遵循以下模式:<project ID>.appspot.com:8080
。您可以在Google Developers Console。
如果您尝试实施this,我强烈建议您试用GoogleCloudMessaging API。