通知中的所有设备 [英] Notification in all devices

查看:122
本文介绍了通知中的所有设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面code可以完美的平板电脑中,但不是在Android手机。我想说明的通知。

Below code works perfect in tablet but not in android phone. I want to show notification.

我的code是:

            if(trigId.equals("0")){
                 intent=new Intent(this,message_detail.class);
            }else{
                 intent=new Intent(this,appinement_list.class);
            }

            PendingIntent pIntent=PendingIntent.getActivity(this, 0, intent, 0);
            //  nt=new Notification(R.drawable.ic_launcher, "Welco0me", System.currentTimeMillis());
            Notification noti = new Notification.Builder(this)
            .setContentTitle("Notification From EHIQ").setSound(alarmSound).setContentIntent(pIntent)
            .setContentText(" "+Helper_MSGNotification.Subject.get(i)).setSmallIcon(aspl.scorehealth.R.drawable.ic_launcher).build();
            NotificationManager manager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
            noti.flags|=Notification.FLAG_AUTO_CANCEL;
            manager.notify(i,noti); 

我搞不清什么是真正的问题,请帮助我。

I am confuse what is actually problem,please help me.

推荐答案

在Eclipse中右键单击项目,然后选择Android的工具添加支持库,然后安装

In Eclipse Right click on project then choose Android Tools Add support Library Then Install

变更将以下内容:

import android.support.v4.app.NotificationCompat;

NotificationCompat.Builder noti = new NotificationCompat.Builder(this);

这篇关于通知中的所有设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆