我是android新手。我需要开发通知我的应用程序。我见过gcm(android hive)示例和简单的通知示例。
我对这个例子感到困惑。请指导我如何做实时通知?
mn = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nb = new NotificationCompat.Builder(this);
nb.setSmallIcon(R.drawable.ic_action_mail_add);
nb.setTicker("hi");
nb.setContentTitle("mail");
BitmapDrawable bd = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_action_mail);
Bitmap b= bd.getBitmap();
nb.setLargeIcon(b);
nb.setContentText("haii..");
nb.setContentInfo("3 unread");
nb.setAutoCancel(true);
Intent in = new Intent(this,NotificationActivity.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, in, PendingIntent.FLAG_UPDATE_CURRENT);
nb.setContentIntent(pi);