Java Code Examples for android.content.Intent.ACTION_TIME_TICK

The following are Jave code examples for showing how to use ACTION_TIME_TICK of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: sample-bluetooth-le-gattserver   File: GattServerActivity.java   View Source Code Vote up 8 votes
@Override
public void onReceive(Context context, Intent intent) {
    byte adjustReason;
    switch (intent.getAction()) {
        case Intent.ACTION_TIME_CHANGED:
            adjustReason = TimeProfile.ADJUST_MANUAL;
            break;
        case Intent.ACTION_TIMEZONE_CHANGED:
            adjustReason = TimeProfile.ADJUST_TIMEZONE;
            break;
        default:
        case Intent.ACTION_TIME_TICK:
            adjustReason = TimeProfile.ADJUST_NONE;
            break;
    }
    long now = System.currentTimeMillis();
    notifyRegisteredDevices(now, adjustReason);
    updateLocalUi(now);
}
 
Example 2
Project: buildAPKsSamples   File: ClockActivity.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    h1View = (ImageView)findViewById(R.id.h1);
    h2View = (ImageView)findViewById(R.id.h2);
    m1View = (ImageView)findViewById(R.id.m1);
    m2View = (ImageView)findViewById(R.id.m2);
    
    setTime();
    
    receiver = new TickReceiver();
    filter = new IntentFilter(Intent.ACTION_TIME_TICK);        
}
 
Example 3
Project: Android-Gank-Share   File: MainActivity.java   View Source Code Vote up 6 votes
private void setReceiver() {
    IntentFilter timeFilter = new IntentFilter(Intent.ACTION_TIME_TICK);
    timeReceiver = new TimeReceiver();
    timeReceiver.setActivity(this);
    timeReceiver.setRecommendFragment((GankRecommendFragment) mFragmentList.get(0));
    internetReceiver = new InternetReceiver();
    registerReceiver(timeReceiver, timeFilter);
    internetReceiver = new InternetReceiver();
    internetReceiver.setActivity(this);
    IntentFilter InternetFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    registerReceiver(internetReceiver, InternetFilter);
}