Detecting new MMS (Android 2.1)

谁说我不能喝 提交于 2019-11-28 12:03:43

问题


I'd like to recognize arrival of new MMS msg (after it is downloaded to inbox). I am doing the following:

private MMSContentObserver mMmsCO;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    h = new Handler();
    mMmsCO = new MMSContentObserver(h);
    getContentResolver().registerContentObserver (Uri.parse("content://mms"), true, mMmsCO);
}

where

    private class MMSContentObserver extends ContentObserver {

    public MMSContentObserver(Handler h) {
        super(h);
    }               

    @Override
    public boolean deliverSelfNotifications() {
        return false;
    }

    @Override
    public void onChange(boolean selfChange) {
        super.onChange(selfChange);
    }
}

However, onChange is not getting called. What am I missing? Thanks in advance.


回答1:


The MMS content provider isn't part of the SDK but it can be used... a real answer here would be nice since all messaging apps use content://mms in some way or shape.

Since google decided not to standardize MMS we are all have to test on every phone out there but we still need to be able to handle MMSs in our apps.



来源:https://stackoverflow.com/questions/3056455/detecting-new-mms-android-2-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!