Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.content.Context; import android.telephony.TelephonyManager; public class Main { public static String getDeviceID(Activity a) { TelephonyManager tm = (TelephonyManager) a.getApplicationContext() .getSystemService(Context.TELEPHONY_SERVICE); String id = tm.getDeviceId(); if (id == null) id = "DefaultTwitchUser"; return Integer.toHexString(id.hashCode()); } }