SMS_RECEIVED not working on Ice Cream Sandwich?

前端 未结 6 979
猫巷女王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条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 23:47

    I think your error is that you use the class name in your package name.

    In your manifest you wrote package="com.giggsey.MyFirstApp" and also in your receiver. This would mean that the full name of your receiver is com.giggsey.MyFirstApp.MyFirstApp, but I belive it is just com.giggsey.MyFirstApp.

    Exchange com.giggsey.MyFirstApp in your manifest with com.giggsey that sould work if I guess right.

    
    
    [...]
    

    And also this:

    package com.giggsey;
    
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.util.Log;
    
    public class MyFirstApp extends BroadcastReceiver {
        private static final String TAG = "MyFirstApp";
    
        @Override
        public void onReceive(Context context, Intent intent) {
            Log.i(TAG, "Intent recieved: " + intent.getAction());
        }
    }
    

提交回复
热议问题