Java Code Examples for android.content.Intent#ACTION_TIMEZONE_CHANGED

The following examples show how to use android.content.Intent#ACTION_TIMEZONE_CHANGED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 2
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 3
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 4
Source File: SunsetsWatchFace.java    From american-sunsets-watch-face with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    SunsetsWatchFace.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 5
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 6
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 7
Source File: TimeView.java    From AcDisplay with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    switch (intent.getAction()) {
        case Intent.ACTION_TIME_TICK:
        case Intent.ACTION_TIME_CHANGED:
        case Intent.ACTION_TIMEZONE_CHANGED:
            updateClock();
            break;
    }
}
 
Example 8
Source File: myWatchFaceService.java    From wearable with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    myWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 9
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    ComplicationWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 10
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 11
Source File: DigitalWatchFaceService.java    From wear-os-samples with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredReceiver) {
        return;
    }
    mRegisteredReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    filter.addAction(Intent.ACTION_LOCALE_CHANGED);
    DigitalWatchFaceService.this.registerReceiver(mReceiver, filter);
}
 
Example 12
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    ComplicationWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 13
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    ComplicationWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 14
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 15
Source File: beerWatchFaceService.java    From wearable with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    beerWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 16
Source File: TimeReceiver.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    try {
        String action = intent.getAction();
        // 打印当前触发的广播
        LogPrintUtils.dTag(TAG, "onReceive Action: " + action);
        // 判断类型
        switch (action) {
            case Intent.ACTION_TIMEZONE_CHANGED: // 时区改变
                if (sListener != null) {
                    sListener.onTimeZoneChanged();
                }
                break;
            case Intent.ACTION_TIME_CHANGED: // 设置时间
                if (sListener != null) {
                    sListener.onTimeChanged();
                }
                break;
            case Intent.ACTION_TIME_TICK: // 每分钟调用
                if (sListener != null) {
                    sListener.onTimeTick();
                }
                break;
        }
    } catch (Exception e) {
        LogPrintUtils.eTag(TAG, e, "onReceive");
    }
}
 
Example 17
Source File: MyTapFace.java    From wearable with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyTapFace.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 18
Source File: AlarmManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void setTimeZoneImpl(String tz) {
    if (TextUtils.isEmpty(tz)) {
        return;
    }

    TimeZone zone = TimeZone.getTimeZone(tz);
    // Prevent reentrant calls from stepping on each other when writing
    // the time zone property
    boolean timeZoneWasChanged = false;
    synchronized (this) {
        String current = SystemProperties.get(TIMEZONE_PROPERTY);
        if (current == null || !current.equals(zone.getID())) {
            if (localLOGV) {
                Slog.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
            }
            timeZoneWasChanged = true;
            SystemProperties.set(TIMEZONE_PROPERTY, zone.getID());
        }

        // Update the kernel timezone information
        // Kernel tracks time offsets as 'minutes west of GMT'
        int gmtOffset = zone.getOffset(System.currentTimeMillis());
        setKernelTimezone(mNativeData, -(gmtOffset / 60000));
    }

    TimeZone.setDefault(null);

    if (timeZoneWasChanged) {
        Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED);
        intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
                | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
                | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
        intent.putExtra("time-zone", zone.getID());
        getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
    }
}
 
Example 19
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    MyWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}
 
Example 20
Source File: myWatchFaceService.java    From wearable with Apache License 2.0 5 votes vote down vote up
private void registerReceiver() {
    if (mRegisteredTimeZoneReceiver) {
        return;
    }
    mRegisteredTimeZoneReceiver = true;
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
    myWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
}