Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Copyright (c) 2014 Microsoft Mobile and/or its subsidiary(-ies).
 * See the license text file delivered with this project for more information.
 */

import android.content.Context;
import android.content.Intent;

import android.util.Log;

public class Main {
    private static final String TAG = "NNASingleAPKSample/CommonUtilities";
    public static final String DISPLAY_MESSAGE_ACTION = "com.nokia.push.codeveldemo.DISPLAY_MESSAGE";
    public static final String EXTRA_MESSAGE = "message";

    /**
     * Notifies UI to display a message. This method is defined in the common
     * helper because it's used both by the UI and the background service.
     *
     * @param context The application context.
     * @param message The message to be displayed.
     */
    public static void displayMessage(Context context, String message) {
        Log.i(TAG, "displayMessage(): " + message);
        Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
        intent.putExtra(EXTRA_MESSAGE, message);
        context.sendBroadcast(intent);
    }
}