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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -