我需要AlarmReceiver在10秒后启动活动(例如).我需要在不运行应用程序的情况下激活它.但无论应用程序是否运行,AlarmReceiver都不会被调用.有什么建议?
Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 111, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
//alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()
//+ (10 * 1000), pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
Run Code Online (Sandbox Code Playgroud) 我想创建一个应用程序,基本上,应该在某个特定的时间启动自己,在后台做一些东西,然后杀死自己.
我需要提示移动方向和阅读内容.我很抱歉有点转储问题,但我是android的初学者.所以任何答复都会很棒.