第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

將SMS消息標(biāo)記為已讀/未讀或刪除在KitKat中不起作用的消息

將SMS消息標(biāo)記為已讀/未讀或刪除在KitKat中不起作用的消息

C#
ibeautiful 2019-11-03 16:04:21
我一直在研究SMS應(yīng)用程序。一切順利,直到昨天,當(dāng)我將Nexus 4更新為Android 4.4 KitKat時(shí)。將SMS標(biāo)記為已讀/未讀以及刪除線程中的所有消息之類的功能已停止工作。為什么會(huì)這樣呢?它可以在其他三星設(shè)備(不運(yùn)行KitKat)上工作。這是我的代碼,用于將郵件標(biāo)記為已讀或未讀:public static void markRead(final Context context, final Uri uri,            final int read) {        Log.d(TAG, "markRead(" + uri + "," + read + ")");        if (uri == null) {            return;        }        String[] sel = Message.SELECTION_UNREAD;        if (read == 0) {            sel = Message.SELECTION_READ;        }        final ContentResolver cr = context.getContentResolver();        final ContentValues cv = new ContentValues();        cv.put(Message.PROJECTION[Message.INDEX_READ], read);        try {            cr.update(uri, cv, Message.SELECTION_READ_UNREAD, sel);        } catch (IllegalArgumentException e) {            Log.e(TAG, "failed update", e);            Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();        }}為了刪除線程中的所有消息,我使用:public static void deleteMessages(final Context context, final Uri uri,            final int title, final int message, final Activity activity) {        Log.i(TAG, "deleteMessages(..," + uri + " ,..)");        final Builder builder = new Builder(context);        builder.setTitle(title);        builder.setMessage(message);        builder.setNegativeButton(android.R.string.no, null);        builder.setPositiveButton(android.R.string.yes,                new DialogInterface.OnClickListener() {                    @Override                    public void onClick(final DialogInterface dialog,                            final int which) {                        final int ret = context.getContentResolver().delete(                                uri, null, null);                        Log.d(TAG, "deleted: " + ret);                        if (activity != null && !activity.isFinishing()) {                            activity.finish();                        }
查看完整描述

1 回答

?
叮當(dāng)貓咪

TA貢獻(xiàn)1776條經(jīng)驗(yàn) 獲得超12個(gè)贊

使用Android 4.4,SMS發(fā)生了一些變化。其中一個(gè)事實(shí)是,只有注冊為默認(rèn)SMS應(yīng)用程序的應(yīng)用程序才能訪問提供程序。


在此處查看有關(guān)SMS更改的簡短說明。


檢查此鏈接可了解更深入的信息。這篇解釋了您的應(yīng)用程序要成為默認(rèn)消息傳遞應(yīng)用程序需要滿足的條件。


這是官方的好玩的東西。


因此,如果您的應(yīng)用不是默認(rèn)的消息傳遞應(yīng)用,這就是為什么指定功能停止工作的原因。


可以在此處的答案中找到默認(rèn)提供者限制的可能解決方法。



查看完整回答
反對 回復(fù) 2019-11-04
  • 1 回答
  • 0 關(guān)注
  • 262 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號