Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.support.annotation.NonNull; public class Main { public static final String deviceNameKey = "gpodder_device"; public static String getDeviceCaption(@NonNull Context argContext) { SharedPreferences argSharedPreferences = PreferenceManager.getDefaultSharedPreferences(argContext); return argSharedPreferences.getString(deviceNameKey, getDeviceID()); } private static String getDeviceID() { return android.os.Build.MODEL.replaceAll("\\s", ""); } }