Java tutorial
//package com.java2s; /** * Global Sensor Networks (GSN) Source Code * Copyright (c) 2006-2014, Ecole Polytechnique Federale de Lausanne (EPFL) * * This file is part of GSN. * * GSN is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GSN is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GSN. If not, see <http://www.gnu.org/licenses/>. * * File: gsn-tiny/src/tinygsn/gui/android/gcm/CommonUtilities.java * * @author Do Ngoc Hoan */ import android.content.Context; import android.content.Intent; public class Main { /** * Intent used to display a message in the screen. */ public static final String DISPLAY_MESSAGE_ACTION = "com.google.android.gcm.demo.app.DISPLAY_MESSAGE"; /** * Intent's extra that contains the message to be displayed. */ public static final String EXTRA_MESSAGE = "message"; public static final String EXTRA_SERVER_NAME = "server_name"; public static void broadcastMessage(Context context, String servername, String message) { Intent intent = new Intent(DISPLAY_MESSAGE_ACTION); intent.putExtra(EXTRA_SERVER_NAME, servername); intent.putExtra(EXTRA_MESSAGE, message); context.sendBroadcast(intent); } }