Issue - IMEI - HTC Flyer Tab [Telephony Manager]

I have HTC Flyer tab with version Android 2.3.4. I am not able to retrieve the IMEI number through TelephonyManager.getDeviceId(). It always return null.

Can somebody try to read out the IMEI on another device. I would like to know whether it is a Google or HTC problem.

This is a 'GSM' device. And it is brand new, didn't have any OS update.

FYI, Included Manifest:

My programs on sumsung galaxy, Motorola xoom, and all smartphones working well.

--------------Solutions-------------

Some of the tab devices do not have IMEI number. You can get WI-FI MAC address of the device.

WifiManager wifiMan = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInf = wifiMan.getConnectionInfo();
String ID = wifiInf.getMacAddress();

@SuppressWarnings("rawtypes")
Class SystemProperties = null;
SystemProperties = Class.forName("android.os.SystemProperties");

//Parameters Types
@SuppressWarnings("rawtypes")
Class[] paramTypes = new Class[1];
paramTypes[0] = String.class;

Method get=null;
get = SystemProperties.getMethod("get", paramTypes);

//Parameters
Object[] params = new Object[1];
params[0] = new String("ro.gsm.imei");

IMEI = (String) get.invoke(SystemProperties, params);

if you are getting null with TelephonyManager.getDeviceId(), use

Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID);

for example:

final TelephonyManager mTelephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (mTelephony.getDeviceId() != null){
AndroidDeviceId = mTelephony.getDeviceId();
}
else{
AndroidDeviceId = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID);
}

even ANDROID_ID is not secure to use:

More specifically, Settings.Secure.ANDROID_ID. This is a 64-bit quantity that is generated and stored when the device first boots. It is reset when the device is wiped.

ANDROID_ID seems a good choice for a unique device identifier. There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 (“Froyo”). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID.

but i recommed use this method suggested in Android Developer´s Blog: Identifying App Installations:

public class Installation {
private static String sID = null;
private static final String INSTALLATION = "INSTALLATION";

public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists())
writeInstallationFile(installation);
sID = readInstallationFile(installation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
}

private static String readInstallationFile(File installation) throws IOException {
RandomAccessFile f = new RandomAccessFile(installation, "r");
byte[] bytes = new byte[(int) f.length()];
f.readFully(bytes);
f.close();
return new String(bytes);
}

private static void writeInstallationFile(File installation) throws IOException {
FileOutputStream out = new FileOutputStream(installation);
String id = UUID.randomUUID().toString();
out.write(id.getBytes());
out.close();
}
}

Category:android Time:2011-10-24 Views:0

Related post

  • Crash log on HTC Flyer 2011-10-24

    Several applications (especially "Notes", com.htc.notes; much less frequently - Mail and Evernote) crash very frequently on my HTC Flyer tablet. I want to know the reason for these crashes. Where can I find the logs? --------------Solutions----------

  • Not able to sync HTC Flyer with computer 2012-04-01

    Hi i'm trying to sync an htc Flyer on a windows 7 64 bit all in one PC. I know there is a problem with Windows pulling down the wrong drivers. Anyone come across this and know how to fix? Regards Brian --------------Solutions------------- Hello, 1.Wh

  • Android Facebook SDK - onActivityResult flakey on HTC Flyer-not on DroidX though 2012-01-30

    I have been following the example code provided by Facebook for implementing this SDK. I have noticed different behavior on different devices. For some reason, my DroidX is working great, but when I run the same code on the HTC Flyer, most of the tim

  • Android Browser Freezes in HTC-Flyer 2012-04-24

    My default android3.2 browser freezes after running jquery mobile app for some time in HTC Flyer. It works fine on iOS5 running iPod. and it also runs fine on my Samsung Galaxy S running Android 2.2. Is this fault of HTC or Android 3.2 browser. Have

  • Android HTC Flyer - Capturing stylus with MotionEvents 2012-04-25

    I'm developing an app which is designed to capture writing on the canvas. The app is designed for use with HTC Flyer (Android 2.3.3). This device already has Scribbler installed, so I have disabled "Auto launch Scribbler mode" but left "Pen history f

  • Can I install office 2010 no my HTC Flyer Tablet 2012-12-06

    Can I install office 2010 no my HTC Flyer Tablet? --------------Solutions------------- since HTC Flyer uses the Android OS (if I remember well) I think you cannot install Microsoft Office 2010 on it. Bye.

  • My "Folder and Search Options" tab, "Task Manager ", "Run" & browsers other than windows Explorer is hidden and not acessible. Urgent help is needed. 2014-02-13

    As i Said in the title my problem is that i am not able to acess "Folder and Search Options" tab, "Task Manager ", "Run" & browsers other than windows Explorer 1. In case of "Folder and search options" tab in the organize tab in the explorer wind

  • +961code issue on HTC 7 Pro, Win7.5, Lebanon MTC-touch operator, Zune 4.8.2345, Win7 on Laptop. 2014-03-23

    I have the HTC 7 Pro, Win7.5, Lebanon MTC-touch operator, Zune 4.8.2345, Win7 on Laptop. The issue is with the contact phone list which I have its code starting with +961 country code. Whenever I get a call from any numbers type saved in the contacts

  • Media syncing issues with HTC Mozart WP 7.8 2014-08-27

    Hi there! :) I have been having syncing issues with HTC Mozart. The OS is WP 7.8 and I'm using a Mac. The problem is that when I choose the songs I want from the sync app almost all the time the songs, even though there is no error, they just don't g

  • IE unstable..intermittent connection issues, cannot open second Tab 2015-03-12

    We suddently started experiencing IE problems: connection and loading issues where it will only read CONNECTING with the little circle going round and round but nothing happens but when I close it down then re-open, it may connect. Another issues, ca

  • Using Telephony Manager in android to find IMEI number 2011-09-22

    I m very new to Android Development. I want to find the IMEI number of the phone and using "android.telephony.TelephonyManager;". TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.getD

  • All kinds of sync issues between HTC diamond / vista / exchange 2012-02-02

    I've been having a Sony Ericsson P1 connected to our Exchange server for a very long time with no issues what so ever. I got the chance to try out a HTC Diamond with windows mobile 6.1 and I thought it was going to be nice to see how ActiveSync works

  • display issue in IE10 new tab 2012-09-09

    Hi I am having display issues when I open a new tab. immediately after hovering over existing tabs or pressing drop down menu, the screen leaves behind what I have just done. sorry I am unable to explain properly so I added image. I am running W7 on

  • IE7 issues with website;multiple tabs & windows keep opening 2012-09-12

    If I start on one tab @ sky.com & log in I get another window open, in addition to another tab in the original window. The new window has aboutprotectedmodeoff in the address bar. In the new tab on the original I am asked to log in again. If I th

  • Text messaging issues for HTC Snap. 2014-07-27

    I recently purchased an HTC snap from sprint with windows mobile 6.1. For the most part I'm happy with the phone itself. My only issue is with the text messaging. When I receive a text message, it only displays the date next to the name of the recpie

  • start/home button issues for asus vivo tab 2014-08-24

    I just bought the Asus vivo tab and I am already having issues. When I am in an app and I swipe the right side and click the 'home' or start button, even when I push it on the bottom, it brings me to a blank screen. If I try clicking it again it usua

  • Using Tab Focus Manager In A Title Window Flex 2010-09-07

    I'm struggling to get around an error that is constantly thrown in my application when I press the tab key. I have a modal dialog box that contains a form with 3 form items. Whenever I press the tab button flex throws an error saying "ArgumentError:

  • Sqlite issues with HTC Desire HD 2011-01-17

    Recently I have been getting a lot of complaints about the HTC Desire series and it failing while invoking sql statements. I have received reports from users with log snapshots that contain the following. I/Database( 2348): sqlite returned: error cod

  • Issue with jQuery UI Tabs (loaded via ajax) and form data 2011-02-23

    I am attempting to set up an interface that has a form containing filters about some jQuery UI Tabs. The tabs are loaded via ajax. When I click on one of the tabs, I want the data from the form to be submitted to that tab. I set up the ajaxOptions to

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.910 (s). 13 q(s)