-1

Im trying to utilize the code found at: http://androidstream.wordpress.com/2012/01/26/android-how-to-get-installed-applications-list-from-your-application/

The only problem is, line 5 of the example code apparently can be resolved, even though im importing everything from util. Line 5 is as follows:

 String deviceId=Util.getDeviceId(getApplicationContext());

Any udeas as to the problem and how to fix it?

Thanks in advance!

Jack
  • 53
  • 1
  • 4

1 Answers1

0

This might be related to this or this, which were solutions to common problems in the rev. 22 update.\ UPDATE:

It seem this code is used to get IMEI.

   String deviceId=Util.getDeviceId(getApplicationContext());

Use it instead:

 TelephonyManager telephonyManager = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        String deviceId = telephonyManager.getDeviceId();

I think this problem is this page you refer is not show all code, may be there still remain one class Util:

public static class Util {
        public static String getDeviceId(Context context) {
            TelephonyManager telephonyManager = (TelephonyManager) context
                    .getSystemService(Context.TELEPHONY_SERVICE);
            return telephonyManager.getDeviceId();
        }
    }

Then it explain why they use : Util.getDeviceId(getApplicationContext()) normally. Just copy this code to your class InstalledAppData. The compiler will clean.

Community
  • 1
  • 1
kemdo
  • 1,429
  • 3
  • 15
  • 29
  • Updating now, will check back when its revisions are updated. Hopefully it fixes it! – Jack Oct 20 '14 at 09:33