I have the latest update for my Samsung Galaxy S2 and now my application stop working (App don't receive sms). I have SMSReceiver extends from BroadcastReceiver with SMS_RECEIVED action.
It looks like this:
private class SMSReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context cntxt, Intent intent) {
Log.i(TAG, "New broadcast receiver");
SharedPreferences settings = getSharedPreferences(TAG, 0);
if (settings.getString("authCode", "").equals("")) {
Log.i(TAG, "Get sms");
if (intent.getAction().toString().equals("android.provider.Telephony.SMS_RECEIVED")) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
开发者_如何学运维 final SmsMessage[] messages = new SmsMessage[pdus.length];
for (int i = 0; i < pdus.length; i++) {
messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
}
if (messages.length > -1) {
Log.i(TAG, "Read sms");
}
}
}
}
}
I register BroadcastReceiver like this:
mSmsReceiver = new SMSReceiver();
IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
filter.setPriority(100000);
registerReceiver(mSmsReceiver, filter);
Everything works on HTC Desire or Desire Z and android emulator. On Galaxy S2 my SMSReceiver don't receive any Intent when SMS came. I tried all solution but it didn't have any effect.
Probably a issue with the latest version of GoSMS
Had the same issue with the "android.net.conn.CONNECTIVITY_CHANGE" action on the Galaxy s2. Couldn't receive reconnection intent when the Broadcast receiver was registered in the code. Registering the broadcast receiver in the manifest was the solution for me.
精彩评论