Java源码示例:com.meizu.cloud.pushsdk.PushManager

示例1
public static void init(@NonNull Context context) {

        if ("HuaWei".equals(android.os.Build.MANUFACTURER)) {
            HMSAgent.init(context);
            HMSAgent.connect(this, new ConnectHandler() {
                @Override
                public void onConnect(int rst) {

                }
            });
            HMSAgent.Push.getToken(new GetTokenHandler() {
                @Override
                public void onResult(int rtnCode) {

                }
            });
        } else if ("Xiaomi".equals(android.os.Build.MANUFACTURER)) {
            MiPushClient.registerPush(context, "APP_ID", "APP_KEY");
        } else if (MzSystemUtils.isBrandMeizu(context)) {
            PushManager.register(context, "APP_ID", "APP_KEY");
        }else {

        }
    }
 
示例2
@Override
public void register(Context context, boolean debug, PushInterface pushInterface) {
    if (pushInterface != null) {
        FlymeReceiver.registerInterface(pushInterface);
    }
    PushManager.register(context, Const.getFlyme_app_id(), Const.getFlyme_app_key());
}
 
示例3
@Override
public TokenModel getToken(Context context) {
    if (context == null)
        return null;
    TokenModel result = new TokenModel();
    result.setTarget(RomUtil.rom());
    result.setToken(PushManager.getPushId(context));
    return result;
}
 
示例4
@Override
public void pause(Context context) {
    PushManager.unRegister(context, Const.getFlyme_app_id(), Const.getFlyme_app_key());
    if (FlymeReceiver.getPushInterface() != null) {
        FlymeReceiver.getPushInterface().onPaused(context);
    }
}
 
示例5
@Override
public void resume(Context context) {
    PushManager.register(context, Const.getMiui_app_id(), Const.getFlyme_app_key());
    if (FlymeReceiver.getPushInterface() != null) {
        FlymeReceiver.getPushInterface().onResume(context);
    }
}
 
示例6
@Override
public void registerPush(Context context) {
    PushManager.register(context, appId, appKey);
    Logger.i("注册meizu push registerPush" );
}
 
示例7
@Override
public void unRegisterPush(Context context) {
    Logger.i("注销meizu push registerPush" );
    PushManager.unRegister(context, appId, appKey);
    HttpUtil.unregistPushinfo(PhoneInfoUtils.getUniqueID(), QTPushConfiguration.getPlatName(), true);
}
 
示例8
@Override
public void clearNotification(Context context) {
    PushManager.clearNotification(context);
}
 
示例9
@Override
public void register(Context context, RegisterType type) {
    appId = getMetaData(context, "MEIZU_APP_ID");
    appKey = getMetaData(context, "MEIZU_APP_KEY");
    PushManager.register(context, appId, appKey);
}
 
示例10
@Override
public void unRegister(Context context) {
    PushManager.unRegister(context, appId, appKey);
}
 
示例11
@Override
public String getRegisterId(Context context) {
    return PushManager.getPushId(context);
}
 
示例12
@Override
public void unregister(Context context) {
    FlymeReceiver.clearPushInterface();
    PushManager.unRegister(context, Const.getFlyme_app_id(), Const.getFlyme_app_key());
}
 
示例13
@Override
public void setAlias(Context context, String alias) {
    PushManager.subScribeAlias(context, Const.getFlyme_app_id(), Const.getFlyme_app_key(), getToken(context).getToken(), alias);

}