Android 如何让通知经理工作?

Android 如何让通知经理工作?,android,Android,当我打电话时 NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 我犯了一个错误 The method getSystemService(String) is undefined for the type new BroadcastReceiver(){}

当我打电话时

NotificationManager mNotificationManager =
                                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
我犯了一个错误

The method getSystemService(String) is undefined for the type new BroadcastReceiver(){}
我不知道我在哪里搞砸了。。。 TIA

像这样使用

NotificationManager mNotificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

NotificationManager mNotificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

据我所知,从BroadcastReceiver调用一些涉及上下文的方法是不安全的,如
Context.bindService()

据我所知,从BroadcastReceiver调用一些涉及上下文的方法是不安全的,如
Context.bindService()所述

在broadcastReceiver中,您在哪里调用此语句?在broadcastReceiver中,您在哪里调用此语句?