SMS_RECEIVED not working on Ice Cream Sandwich?

前端 未结 6 1053
猫巷女王i
猫巷女王i 2021-01-03 22:51

I\'m trying to use android.provider.Telephony.SMS_RECEIVED to catch incoming SMS\'s.

I built a simple app, which works on 2.x, but when I try it on my 4.0 emulator o

6条回答
  •  萌比男神i
    2021-01-03 23:47

    in the On receive please try to add the following line

    private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
    
    if (intent.getAction() == SMS_RECEIVED) {
        //any action you want here..
        Toast.makeText(MyClass.this, "SMS RECEIVED",Toast.LENGTH_LONG).show();
    }
    

提交回复
热议问题