public static Builder create(String downloadUrl) { if (downloadUrl == null) { throw new NullPointerException("downloadUrl == null"); } return new Builder(downloadUrl); }
public Builder build(Context context) { if (context == null) { throw new NullPointerException("context == null"); } Intent intent = new Intent(); intent.setClass(context, UpdateService.class); intent.putExtra(URL, downloadUrl); if (icoResId == DEFAULT_RES_ID) { icoResId = getIcon(context); } if (icoSmallResId == DEFAULT_RES_ID) { icoSmallResId = icoResId; } intent.putExtra(ICO_RES_ID, icoResId); intent.putExtra(STORE_DIR, storeDir); intent.putExtra(ICO_SMALL_RES_ID, icoSmallResId); intent.putExtra(UPDATE_PROGRESS, updateProgress); intent.putExtra(DOWNLOAD_NOTIFICATION_FLAG, downloadNotificationFlag); intent.putExtra(DOWNLOAD_SUCCESS_NOTIFICATION_FLAG, downloadSuccessNotificationFlag); intent.putExtra(DOWNLOAD_ERROR_NOTIFICATION_FLAG, downloadErrorNotificationFlag); intent.putExtra(IS_SEND_BROADCAST, isSendBroadcast); context.startService(intent); return this; }
public void updateStore(View view){ UpdateService.Builder.create(URL) .setStoreDir("update/store") .build(this); }
public void updateFlag(View view){ UpdateService.Builder.create(URL) .setStoreDir("update/flag") .setDownloadSuccessNotificationFlag(Notification.DEFAULT_ALL) .setDownloadErrorNotificationFlag(Notification.DEFAULT_ALL) .build(this); }