JackAW
JackAW

Reputation: 173

GAE as GCM server

I try to run Google GAE as GCM server based on Google example GCM Demo project with Android as client: link. My question is what should be Server_URL declared in Android java class CommonUtilities? The source is below. I have registered GAE application for it. My Android application is working, and already registered to GCM service. But it can not register device to my GAE app (originally Demo server). Any hint very welcome. Thanks.

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);
    }
}

Upvotes: 0

Views: 167

Answers (1)

Koh
Koh

Reputation: 1570

If your web app is hosted on Google App Engine, it usually contains the project ID of your project. It typically follows the following pattern: <project ID>.appspot.com:8080. You can find this project ID in your Google Developers Console.

If this is what you are trying to implement, I would highly recommend that you try out the GoogleCloudMessaging API instead.

Upvotes: 1

Related Questions