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.SharedPreferences;
import android.preference.PreferenceManager;

public class Main {
    private static final String PREFS_KEY_SENDER_ID = "sender_id";
    public static final String DEFAULT_SENDER_ID = "anna-example";

    /** 
     * @param context The application context.
     * @return The stored sender ID or the default value if not available.
     */
    public static String getSenderId(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getString(PREFS_KEY_SENDER_ID, DEFAULT_SENDER_ID);
    }
}