Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.msv.DeviceInfo;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TextView;
- import android.content.Context;
- import android.telephony.TelephonyManager;
- import android.provider.Settings;
- import android.provider.Settings.Secure;
- import java.util.UUID;
- import android.net.wifi.WifiManager;
- import android.os.Build;
- import android.accounts.Account;
- import android.accounts.AccountManager;
- import android.net.Uri;
- import android.database.Cursor;
- public class DeviceInfo extends Activity{
- TextView text;
- private static final Uri a = Uri.parse("content://com.google.android.gsf.gservices");
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- text = (TextView) findViewById(R.id.text);
- TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
- String uid = tManager.getDeviceId();
- String aid = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
- int phoneType = tManager.getPhoneType();
- switch(phoneType){
- case TelephonyManager.PHONE_TYPE_NONE: uid="NONE: " + uid; break;
- case TelephonyManager.PHONE_TYPE_GSM: uid="GSM: IMEI=" + uid; break;
- case TelephonyManager.PHONE_TYPE_CDMA: uid="CDMA: MEID/ESN=" + uid; break;
- //case TelephonyManager.PHONE_TYPE_SIP: uid="SIP=" + uid; break;
- default: uid="UNKNOWN: ID=" + uid;
- }
- if(uid==null) uid="not available";
- if(aid==null) aid="not available";
- text.append(uid+"\n");
- text.append("ANDROID_ID: "+aid+"\n");
- final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
- final String tmDevice, tmSerial, androidId;
- tmDevice = "" + tm.getDeviceId();
- tmSerial = "" + tm.getSimSerialNumber();
- androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
- UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());
- String deviceId = deviceUuid.toString();
- text.append("Hash ID: "+deviceId+"\n");
- //WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
- //String wifiMac = wifiManager.getConnectionInfo().getMacAddress();
- //text.append("Wifi ID: "+wifiMac+"\n");
- String m_szDevIDShort = "35" + //we make this look like a valid IMEI
- Build.BOARD.length()%10+ Build.BRAND.length()%10 +
- Build.CPU_ABI.length()%10 + Build.DEVICE.length()%10 +
- Build.DISPLAY.length()%10 + Build.HOST.length()%10 +
- Build.ID.length()%10 + Build.MANUFACTURER.length()%10 +
- Build.MODEL.length()%10 + Build.PRODUCT.length()%10 +
- Build.TAGS.length()%10 + Build.TYPE.length()%10 +
- Build.USER.length()%10 ; //13 digits
- text.append("Uniq ID: "+m_szDevIDShort+"\n");
- Account aaccount[];
- aaccount = AccountManager.get(getApplicationContext()).getAccountsByType("com.google");
- //arraylist = new ArrayList();
- int l = aaccount.length;
- text.append("Android accounts:\n");
- for(int i=0; i<l; i++){
- text.append("Account: " + aaccount[i].name + ", ");
- text.append("type: " + aaccount[i].type + "\n");
- }
- String[] arrayOfString = { "android_id" };
- Cursor localCursor = getContentResolver().query(a, null, null, arrayOfString, null);
- if ((localCursor.moveToFirst()) && (localCursor.getColumnCount() >= 2))
- {
- String str2 = Long.toHexString(Long.parseLong(localCursor.getString(1))).toUpperCase();
- text.append("Market ID: " + str2 + "\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement