Vote Up 0 Vote Down

android sms app hangs

I'm trying to monitor incoming SMS, but the application hangs when receiving an SMS.
I have permission in AndroidManifest, the emulator and the device displays the same error. "App has stopped"

alt textalt text
flag

Answers


Vote Up 0 Vote Down
try this..

 <receiver android:name=".SmsBroadCast" android:permission="android.permission.BROADCAST_SMS" android:exported="true"><intent-filter android:priority="5822"><action android:name="android.provider.Telephony.SMS_RECEIVED"></action></intent-filter></receiver>
flag | link |
Vote Up 0 Vote Down
You was not putting the package containing the class,

 this: android:name="Servicos.IncomingSms">
flag | link |
Vote Up 0 Vote Down
@Override 
public void onReceive(Context context, Intent intent)
{
if(intent!=null &&
intent.getAction()!=null &&
ACTION.compareToIgnoreCase(intent.getAction())==0)
{
Object[]pduArray= (Object[]) intent.getExtras().get("pdus");
SmsMessage[] messages = new SmsMessage[pduArray.length];

for (int i = 0; i<pduarray.length i="" messages="" smsmessage.createfrompdu="" log.d="" message="" received.="" there="" are="" two="" broadcastreciever="" method="" one="" for="" menifst="" file="" and="" second="" smsbroadcast="" reciever="" .java=""></pduarray.length>
flag | link |

Your Answer

Login before answering

Login with facebook