I am trying to get the unique device ID inside my Application class constructor:
public class ApplicationClass extends Application { public ApplicationClass() { TelephonyManager mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); deviceID = mTelephonyMgr.getDeviceId(); . . . } My code will run right until it gets to creating the telephony manager instance but will not actually create it and it throws a NullPointerException (I think). Is there something I'm doing wrong? Do I have to create a context and call getSystemService(...) with context.getSystemService(...)? I also get the same error when I comment those two lines out and try to get the LocationManager: locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Same exact error happens. Am I only allowed to call getSystemService inside of an Activity class because I've tried calling it in a Service and of course Application with no luck. Any help is appreciated. -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en