TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Android Unique Identificatin Numer
Chintan Rathod
Sep 14, 2012
7.7
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
How to get android unique id number.
DevideId.rar
Purpose
Some times, when we are integrate our android application with server, its requirement of server that it can identify every android device uniquely. So to do that, we will learn how to get android id from device.
Android Id
A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
Code
package com.did;
import android.app.Activity;
import android.os.Bundle;
import android.provider.Settings.Secure;
import android.util.Log;
public class DevideIdActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String android_id = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
Log.d("Android","Android ID : "+android_id);
}
}
Output
Android Unique Identificatin Numer
Next Recommended Reading
Using Facebookâs Rebound Spring Animations for Android in Xamarin.Android & other Dot Net Projects