Java源码示例:cn.hugeterry.updatefun.config.UpdateKey

示例1
/**
 * 更新模块
 */
private void setupUpdate() {
    UpdateKey.API_TOKEN = "";
    UpdateKey.APP_ID = "57b14ee3ca87a87c1b0009e6";
    //UpdateKey.DialogOrNotification=UpdateKey.WITH_DIALOG;通过Dialog来进行下载
    UpdateFunGO.init(this);
}
 
示例2
public static void showDownloadView(Context context) {
    DownloadKey.saveFileName =
            GetAppInfo.getAppPackageName(context) + ".apk";
    if (UpdateKey.DialogOrNotification == 1) {
        Intent intent = new Intent();
        intent.setClass(context, DownLoadDialog.class);
        ((Activity) context).startActivityForResult(intent, 0);
    } else if (UpdateKey.DialogOrNotification == 2) {
        Notification.Builder builder = notificationInit(context);
        download = new Download(context, builder);
        download.start();
    }
}
 
示例3
public static void onStop(Context context) {
    if (DownloadKey.TOShowDownloadView == 2 && UpdateKey.DialogOrNotification == 2) {
        download.interrupt();
    }
    if (thread_update != null) {
        thread_update.interrupt();
    }
    if (DownloadKey.ISManual) {
        DownloadKey.ISManual = false;
    }
    if (DownloadKey.LoadManual) {
        DownloadKey.LoadManual = false;
    }
}
 
示例4
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void handleMessage(Message msg) {
    Context context = mContextReference.get();
    switch (msg.what) {
        case DOWN_UPDATE:
            if (UpdateKey.DialogOrNotification == 1) {
                ((DownLoadDialog) context).progressBar.setProgress(progress);
                ((DownLoadDialog) context).textView.setText(progress + "%");
            } else if (UpdateKey.DialogOrNotification == 2) {
                builder.setProgress(length, count, false)
                        .setContentText("下载进度:" + progress + "%");
                notificationManager.notify(1115, builder.build());
            }
            break;
        case DOWN_OVER:
            if (UpdateKey.DialogOrNotification == 1) {
                ((DownLoadDialog) context).finish();
            } else if (UpdateKey.DialogOrNotification == 2) {
                builder.setTicker("下载完成");
                notificationManager.notify(1115, builder.build());
                notificationManager.cancel(1115);
            }
            length = 0;
            count = 0;
            DownloadKey.TOShowDownloadView = 1;
            if (DownloadKey.ISManual) {
                DownloadKey.LoadManual = false;
            }
            if (checkApk(context)) {
                Log.i("UpdateFun TAG", "APK路径:" + apkFile);
                InstallApk.startInstall(context, apkFile);
            }
            break;
        default:
            break;
    }
}
 
示例5
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //TODO:填上在http://fir.im/注册账号后获得的API_TOKEN以及APP的应用ID
    UpdateKey.API_TOKEN = "";
    UpdateKey.APP_ID = "578a11e7748aac01b7000039";
    //如果你想通过Dialog来进行下载,可以如下设置
    //UpdateKey.DialogOrNotification=UpdateKey.WITH_DIALOG;
    UpdateFunGO.init(this);
}
 
示例6
private void UpdateModel() {
    UpdateKey.API_TOKEN = "";
    UpdateKey.APP_ID = "573ecefa748aac36f4000007";
    UpdateFunGO.init(this);
}
 
示例7
private void setupUpdate() {
    UpdateKey.API_TOKEN = CoderfunKey.API_TOKEN;
    UpdateKey.APP_ID = CoderfunKey.APP_ID;
    UpdateFunGO.init(this);
}