Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    private final static String KeyLastMessage = "lastMessage";
    private final static String AppName = "PushUnityNotification";
    private final static int PrivateMode = 0;

    /** This function save last Push Notification message in prferences
     * @param projectNo
     */
    public static void saveLastMessage(String message, Context context) {
        SharedPreferences sharedPreference = context.getSharedPreferences(AppName, PrivateMode);

        SharedPreferences.Editor prefEditor = sharedPreference.edit();
        prefEditor.putString(KeyLastMessage, message);
        prefEditor.commit();
    }
}