get Device Id from TelephonyManager - Android Hardware

Android examples for Hardware:Device ID

Description

get Device Id from TelephonyManager

Demo Code


//package com.java2s;

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    public static String getDeviceId(Context context) {
        TelephonyManager telephonyManager = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        return telephonyManager.getDeviceId();
    }//from  w ww  .jav  a  2s. c  o m
}

Related Tutorials