所以我对经过的实时警报不熟悉,我试图在手机打开后让我的服务运行,但服务似乎没有运行。
设置闹钟。
Intent sintent=new Intent(getApplicationContext(),alrmsetter.class);
PendingIntent setter= PendingIntent.getService(getApplicationContext(),137,sintent,0);
AlarmManager mmanager=(AlarmManager)getSystemService(ALARM_SERVICE);
mmanager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,6*1000,setter);
服务
public class alrmsetter extends Service
{
public IBinder onBind(Intent intent)
{
return null;
}
public int onStartCommand(Intent intent, int flags, int startId)
{
Log.i("AREW","CLASS STRTED?");
return super.onStartCommand(intent, flags, startId);
}
}