1

I need my app to react when there is a notification about incoming email, sms or call.

I can use the NotificationManager to create notifications, but not read them from other apps.

I have looked at AccessibilityManager, but I can't quite figure that out either.

Any pointers or examples? Thanks

Rasped
  • 13
  • 2

3 Answers3

0

You should register BroadcastReceiver and listen for specific intents.

0

You should look at this for incoming SMS.

Email might be impossible in general, but here is a discussion about recieving notifications from Gmail client.

Incoming calls were discussed here.

Community
  • 1
  • 1
Karsten
  • 1,814
  • 2
  • 17
  • 32
0
  1. Email. I don't think you can do it using standart libraries. Probably it has sense to search third party API
  2. SMS. You shuold use BroadcatReceiver for ACTION ="android.provider.Telephony.SMS_RECEIVED"
  3. CALL. Use PhoneStateListener

TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);

telephonyManager.listen(new PhoneStateListener() {

   @Override 
   public void onCallStateChanged(int state,String incomingNumber) { 
                 //do smth
   } 
}, PhoneStateListener.LISTEN_CALL_STATE);
Maxim
  • 2,996
  • 17
  • 19
  • Could you point me to how stop this reaction I start when the SMS is read? I mean I need to activate a LED when I get a message, and turn it off when it is read. Should I react to the phone being unlocked and let that turn of my notification? – Rasped Mar 31 '11 at 18:32