Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional Android 2 Application Development
|
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2010, 12:52 PM
Registered User
 
Join Date: Jul 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Trying to retrieve IMEI but Eclipse says "method getSystemService(String) is undefine

Wonder why do I get this error?

String srvcName = Context.TELEPHONY_SERVICE;
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(srvcName);
String deviceId = telephonyManager.getDeviceId();
 
Old July 20th, 2010, 06:13 PM
Authorized User
 
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
Default

From where are you calling that method?
 
Old July 21st, 2010, 12:29 AM
Registered User
 
Join Date: Jul 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I was trying to do this:
---
import android.content.Context;
import android.telephony.TelephonyManager;

public class GeIMEIID {
public GetIMEIID(int iMEIID) {
String srvcName = Context.TELEPHONY_SERVICE;
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(srvcName);
String deviceId = telephonyManager.getDeviceId();
}
}
 
Old July 21st, 2010, 03:40 PM
Authorized User
 
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
Default

getSystemService() is a method specified in android.content.Context. You can call it only on some concrete extension of Context. In your example, you're calling it on this (an instance of GeIMEIID), which is not a concrete extension of Context.

You can call it on, for example, an Activity because Activity is a concrete subclass of Context.
 
Old July 11th, 2011, 01:30 AM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anybody in the long beach,ca area that can help me out?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dim code As String = Request.Item("Code") capacitor143 ASP.NET 2.0 Professional 1 April 20th, 2010 12:03 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
why always happened "parse error: unexpected string" sh746 BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 July 5th, 2009 04:39 PM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.