Friday 15 May 2015

java - Context of GcmIntentSerivce -



java - Context of GcmIntentSerivce -

i have app uses google cloud messaging receive notifications. each message begins unique code , different action taken depending on code (display notification, start new service, etc). 1 of functions implement collect sim card information. have simcard class getfullmsisdn method have problem instantiating class within gcmintentservice , passing context it.

here how instantiate simcard onhandleintent method of gcmintentserivce class:

simcard simcard = new simcard(this); string siminfo = simcard.getfullmsisdn();

simcard class:

public class simcard { private telephonymanager telephonymanager; public simcard(context context) { telephonymanager = (telephonymanager)context.getsystemserivce(context.telephony_service); } public string getfullmsisdn() { homecoming telephonymanager(getdeviceid(); } }

i next error: cannot find symbol method getsystemservice

any ideas doing wrong? examples find on web utilize telephonymanager in activity class not case in example.

maybe need utilize application context.

java android google-cloud-messaging

No comments:

Post a Comment