0
String ns = Context.NOTIFICATION_SERVICE;
        NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

        int icon = R.drawable.ic_launcher;
        CharSequence tickerText = "Test";
        long when = System.currentTimeMillis();

        Notification notification = new Notification(icon, tickerText, when);

        Context context = getApplicationContext();
        CharSequence contentTitle = "Test";
        CharSequence contentText = "testing texts";
        Intent notificationIntent = new Intent(this, HolotestActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);


        notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

        final int HELLO_ID = 1;

        mNotificationManager.notify(HELLO_ID, notification);

我用于通知。如何设置每天早上 9 点通知?我是初学者。:D

4

1 回答 1

-1

为此,您需要创建并运行将一直运行的服务类,然后在与您的时间匹配的时间添加通知栏后,在服务类内部以一定的间隔获取当前时间。服务参考以下链接:

服务

于 2012-08-06T09:16:46.753 回答