500*_*865 3 notifications android fragmentation
以下代码已经确认可以在运行HONEYCOMB +的设备上正常运行.但是在三星Galaxy Y上没有发出任何通知.
        String tickerText = userString + " Download Queued";
        Notification notification =  new NotificationCompat.Builder(this).setAutoCancel(true)
                                                .setContentTitle(userString)
                                                .setContentText("Queued")
                                                .setSmallIcon(R.drawable.stat_sys_download_done)
                                                .setWhen(System.currentTimeMillis())
                                                .setTicker(tickerText)
                                                .build();
        if(DBG_ENABLE) {
            LogUtils.logD(TAG_LOG, "Posting queue notification : " + 0);
        }
        NotificationManager notificationManager =
                (NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE);
        notificationManager.notify(0, notification);
注意 :
stat_sys_download_doneandroid sdk中的drawable复制到我的项目中.我无法想到调试此问题的方法.我不确定我是否还有什么遗漏.任何建议来解决这个问题表示赞赏.
正如CommonsWare建议的那样,我在2.3模拟器上运行应用程序并且崩溃了.原因是没有设置ContentIntent.GingerBread期待ContentIntent.所以我添加了一个假的待定意图,如:
            PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
            Notification notification =  new NotificationCompat.Builder(this).setAutoCancel(true)
                                            .setContentTitle(userString)
                                            .setContentText("Queued")
                                            .setContentIntent(pi)
                                            .setSmallIcon(R.drawable.stat_sys_download_done)
                                            .setWhen(System.currentTimeMillis())
                                            .setTicker(tickerText)
                                            .build();
| 归档时间: | 
 | 
| 查看次数: | 4643 次 | 
| 最近记录: |