Android Open Source - minimalclockfree Tom Clock V1 Service






From Project

Back to project page minimalclockfree.

License

The source code is released under:

Copyright 2011 Richard Martin. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project minimalclockfree listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 *  Tom//from ww  w  .j ava 2  s .c om
 */
package tom.clock;

import android.app.Service;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;

/**
 * @author tom
 *
 */
public class TomClockV1Service extends Service {
  
  private BroadcastReceiver broadcastReceiver;
  
  @Override
  public void onCreate() {
    broadcastReceiver = new BroadcastReceiver() {
      @Override
      public void onReceive(Context context, Intent intent) {
        final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        TomClockV1.updateAppWidget(context, appWidgetManager);
      }
    };

    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_TIME_TICK);
    registerReceiver(broadcastReceiver, intentFilter);
  }

  @Override
  public IBinder onBind(Intent intent) {
    return null;
  }

  @Override
  public void onDestroy() {
    unregisterReceiver(broadcastReceiver);
  }
}




Java Source Code List

tom.clock.TomClockV1Configure.java
tom.clock.TomClockV1Service.java
tom.clock.TomClockV1.java