How to get Missed call & SMS count

前端 未结 2 2000
醉酒成梦
醉酒成梦 2020-12-08 12:48

I want to get the count of missed calls and unread messages in my application. and I\'d like to open the relevant application when user click on the count.

Now bigge

2条回答
  •  情歌与酒
    2020-12-08 13:06

    As I don't have enough reputation to answer @Prasad question comment about

    ERROR -> getContentResolver() is undefined for the type new Runnable(){}

    getContentResolver() is part of application context, so if you are using a BroadcastReceiver use context in onReceive() function like this

    @Override
    public void onReceive(Context context, Intent intent) {
        context.getContentResolver()
    }
    

    If you are using the code above inside an Activity, then you can use

    getApplicationContext().getContentResolver()
    

    also make sure to use [Ctrl + Shift + O (O not zero)] to organize imports

    Key Shortcut for Eclipse Imports

提交回复
热议问题