Code example for TimeUnit

Methods: toMillis

0
    private static int sCounter = 0;
 
    private static final Random sRandom = new Random();
 
    private static final int MAX_BACKOFF_MS =
        (int) TimeUnit.SECONDS.toMillis(3600); // 1 hour
 
    // token used to check intent origin 
    private static final String TOKEN =
            Long.toBinaryString(sRandom.nextLong());
    private static final String EXTRA_TOKEN = "token";
 
    /** 
     * Subclasses must create a public no-arg constructor and pass the 
     * sender id to be used for registration. 
     */ 
    protected GCMBaseIntentService(String senderId) {
        // name is used as base name for threads, etc. 
        super("GCMIntentService-" + senderId + "-" + (++sCounter));
        mSenderId = senderId;
    }