Unable to add window — token null is not for an application from Service
问题 I have read many questions like this but none of them seemed to address my problem. The problem lies with: AlertScreen ad = new AlertScreen(SensorListenerService.this); in my Service class: public class SensorListener extends Service implements SensorEventListener { public int onStartCommand(Intent intent, int flags, int startId) { startForeground(Process.myPid(), new Notification()); AlertScreen ad = new AlertScreen(SensorListener.this); //problem ad.show(); return START_STICKY; } ... It