android - In Broadcast receiver class, onReceive method contains custom intent which is not working in Samsung mobile -
here trying build simple sms receiving app. in broadcast receiver class, have onreceive
method contains custom intent not working in samsung mobile(4.1.2) works in kitkat 4.4(moto e).
intent in = new intent("smsmessage.intent.main").putextra("get_body", sms_body); context.sendbroadcast(in);
how do in android 4.1.2?
all need if send data via intent right?
if no please explain mean broadcast not working.
if yes put following inside onreceive()
method.
intent in = new intent(context, ****name of activity****.class) in.putextra("get_body", sms_body) context.startactivity(in);
please take note have mentioned _****name of activity****_change name of activity
inside activity create method onnewintent ()
inside input following code:
string textinsms = intent.getstringextra("get_body")
that's can whatever want textinsms string. holds value of whatever passed it.
Comments
Post a Comment