All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yy.httpproxy.subscribe.RandomPushIdGenerator Maven / Gradle / Ivy

There is a newer version: 1.1.28
Show newest version
package com.yy.httpproxy.subscribe;

import android.content.Context;

import java.math.BigInteger;
import java.security.SecureRandom;

/**
 * Created by xuduo on 10/20/15.
 */
public class RandomPushIdGenerator implements PushIdGenerator {

    @Override
    public String generatePushId(Context context) {
        CachedSharedPreference cachedSharedPreference = new CachedSharedPreference(context);
        String pushId = cachedSharedPreference.get("pushId");
        if (pushId == null) {
            pushId = new BigInteger(130, new SecureRandom()).toString(32);
            cachedSharedPreference.save("pushId", pushId);
        }
        return pushId;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy