2014-12-31 41 views

回答

2

您將通過WatchFaceService.Engine.onPropertiesChanged回調收到燒傷保護和低環境信息。例如:

@Override 
    public void onPropertiesChanged(Bundle properties) { 
     super.onPropertiesChanged(properties); 
     mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false); 
     boolean burnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false); 
     mHourPaint.setTypeface(burnInProtection ? NORMAL_TYPEFACE : BOLD_TYPEFACE); 
     if (Log.isLoggable(TAG, Log.DEBUG)) { 
      Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient); 
     } 
    } 

如果你想測試它,只是直接設定值:

mLowAmbient = true; 
    boolean burnInProtection = true; 

並運行代碼,看看,如果它呈現錶盤。在這種情況下,你應該呈現錶盤,就好像是在低溫環境,並與燒傷保護。檢查所有4種組合,並且您可以繼續使用,您可以返回從包中獲取值。