当前位置: 首页>>代码示例>>Java>>正文


Java Helpers.doesFileExist方法代码示例

本文整理汇总了Java中com.google.android.vending.expansion.downloader.Helpers.doesFileExist方法的典型用法代码示例。如果您正苦于以下问题:Java Helpers.doesFileExist方法的具体用法?Java Helpers.doesFileExist怎么用?Java Helpers.doesFileExist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.vending.expansion.downloader.Helpers的用法示例。


在下文中一共展示了Helpers.doesFileExist方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleFileUpdated

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * The APK has been updated and a filename has been sent down from the
 * Market call. If the file has the same name as the previous file, we do
 * nothing as the file is guaranteed to be the same. If the file does not
 * have the same name, we download it if it hasn't already been delivered by
 * Market.
 *
 * @param index the index of the file from market (0 = main, 1 = patch)
 * @param filename the name of the new file
 * @param fileSize the size of the new file
 * @return
 */
public boolean handleFileUpdated(DownloadsDB db, int index,
        String filename, long fileSize) {
    DownloadInfo di = db.getDownloadInfoByFileName(filename);
    if (null != di) {
        String oldFile = di.mFileName;
        // cleanup
        if (null != oldFile) {
            if (filename.equals(oldFile)) {
                return false;
            }

            // remove partially downloaded file if it is there
            String deleteFile = Helpers.generateSaveFileName(this, oldFile);
            File f = new File(deleteFile);
            if (f.exists())
                f.delete();
        }
    }
    return !Helpers.doesFileExist(this, filename, fileSize, true);
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:33,代码来源:DownloaderService.java

示例2: handleFileUpdated

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * The APK has been updated and a filename has been sent down from the
 * Market call. If the file has the same name as the previous file, we do
 * nothing as the file is guaranteed to be the same. If the file does not
 * have the same name, we download it if it hasn't already been delivered by
 * Market.
 * 
 * @param index the index of the file from market (0 = main, 1 = patch)
 * @param filename the name of the new file
 * @param fileSize the size of the new file
 * @return
 */
public boolean handleFileUpdated(DownloadsDB db, int index,
        String filename, long fileSize) {
    DownloadInfo di = db.getDownloadInfoByFileName(filename);
    if (null != di) {
        String oldFile = di.mFileName;
        // cleanup
        if (null != oldFile) {
            if (filename.equals(oldFile)) {
                return false;
            }

            // remove partially downloaded file if it is there
            String deleteFile = Helpers.generateSaveFileName(this, oldFile);
            File f = new File(deleteFile);
            if (f.exists())
                f.delete();
        }
    }
    return !Helpers.doesFileExist(this, filename, fileSize, true);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:33,代码来源:DownloaderService.java

示例3: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Go through each of the Expansion APK files defined in the project and
 * determine if the files are present and match the required size. Free
 * applications should definitely consider doing this, as this allows the
 * application to be launched for the first time without having a network
 * connection present. Paid applications that use LVL should probably do at
 * least one LVL check that requires the network to be present, so this is
 * not as necessary.
 * 
 * @return true if they are present.
 */
public boolean expansionFilesDelivered() {
    // Determine whether the apk expansion files exist, and the file size is
    // correct
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(mContext, xf.mIsMain, xf.mFileVersion);
        if (!Helpers.doesFileExist(mContext, fileName, xf.mFileSize, false)) {
            if (xf.mIsMain) {
                Log.i("APKExpansionDownloader", "Expansion files are not delivered: main obb does not exist");
            } else {
                Log.i("APKExpansionDownloader", "Expansion files are not delivered: patch obb does not exist");
            }
            return false;
        }
    }
    Log.i("APKExpansionDownloader", "Expansion files are already delivered");
    return true;
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:29,代码来源:ObbDownloadHelper.java

示例4: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
  * Go through each of the APK Expansion files defined in the structure above
  * and determine if the files are present and match the required size. Free
  * applications should definitely consider doing this, as this allows the
  * application to be launched for the first time without having a network
  * connection present. Paid applications that use LVL should probably do at
  * least one LVL check that requires the network to be present, so this is
  * not as necessary.
  * 
  * @return true if they are present.
  */
 boolean expansionFilesDelivered() {
		
     for (OBBData.XAPKFile xf : OBBData.xAPKS) {
         String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
GameActivity.Log.debug("Checking for file : " + fileName);
String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
GameActivity.Log.debug("which is really being resolved to : " + fileForNewFile + "\n Or : " + fileForDevFile);
         if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
	!Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
             return false;
     }
     return true;
 }
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:26,代码来源:DownloaderActivity.java

示例5: onlySingleExpansionFileFound

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
boolean onlySingleExpansionFileFound() {
	for (OBBData.XAPKFile xf : OBBData.xAPKS) {
           String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
		GameActivity.Log.debug("Checking for file : " + fileName);
		String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
		String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
		
		if (Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
			Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
               return false;
	}
	
	return true;		
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:15,代码来源:DownloaderActivity.java

示例6: checkXAPKs

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
public static boolean checkXAPKs(Context context, XAPKFile[] xfs) {
    if (xfs.length == 0) {
        return false;
    }
    for (XAPKFile xf : xfs) {
        String fileName = Helpers.getExpansionAPKFileName(context, xf.mIsMain, xf.mFileVersion);
        if (!Helpers.doesFileExist(context, fileName, xf.mFileSize, false)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:13,代码来源:XAPKFileUitl.java

示例7: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
public static int expansionFilesDelivered() {
    String fileName = Helpers.getExpansionAPKFileName(mainContext, true,version);
    System.out.println("Checking " + fileName);
    if (Helpers.doesFileExist(mainContext, fileName, bytes, false))
        return 1;
    return 0;
}
 
开发者ID:thomasuster,项目名称:android-expansion,代码行数:8,代码来源:Expansion.java

示例8: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
private boolean expansionFilesDelivered() {
       File oldObb = new File(Environment.getExternalStorageDirectory() + "/Android/obb/de.phbouillon.android.games.alite/main.2170.de.phbouillon.android.games.alite.obb");
       if (oldObb.exists()) {
       	oldObb.delete();
       }
    String fileName = Helpers.getExpansionAPKFileName(this, true, AliteConfig.EXTENSION_FILE_VERSION);
    File fileForNewFile = new File(Helpers.generateSaveFileName(this, fileName));
    AliteLog.e("Check for OBB", "OBB exists? " + fileForNewFile.getAbsolutePath());
    return Helpers.doesFileExist(this, fileName, AliteConfig.EXTENSION_FILE_LENGTH, false);
}
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:11,代码来源:AliteStartManager.java

示例9: checkExistance

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
private boolean checkExistance(ExpansionFile[] xapks, Activity activity) {

        boolean check = true;
        for (ExpansionFile xf : xapks) {
            String fileName = Helpers.getExpansionAPKFileName(activity, xf.mIsMain, xf.mFileVersion);
            if (!Helpers.doesFileExist(activity, fileName, xf.mFileSize, false)) {
                check = false;
                break;
            }
        }
        return check;
    }
 
开发者ID:alebianco,项目名称:ANE-Android-Expansion,代码行数:13,代码来源:HasExpansionFiles.java

示例10: startDownloadServiceIfRequired

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Starts the download if necessary. This function starts a flow that does `
 * many things. 1) Checks to see if the APK version has been checked and the
 * metadata database updated 2) If the APK version does not match, checks
 * the new LVL status to see if a new download is required 3) If the APK
 * version does match, then checks to see if the download(s) have been
 * completed 4) If the downloads have been completed, returns
 * NO_DOWNLOAD_REQUIRED The idea is that this can be called during the
 * startup of an application to quickly ascertain if the application needs
 * to wait to hear about any updated APK expansion files. Note that this
 * does mean that the application MUST be run for the first time with a
 * network connection, even if Market delivers all of the files.
 *
 * @param context
 * @param pendingIntent
 * @return true if the app should wait for more guidance from the
 *         downloader, false if the app can continue
 * @throws NameNotFoundException
 */
public static int startDownloadServiceIfRequired(Context context,
        PendingIntent pendingIntent, String classPackage, String className)
        throws NameNotFoundException {
    // first: do we need to do an LVL update?
    // we begin by getting our APK version from the package manager
    final PackageInfo pi = context.getPackageManager().getPackageInfo(
            context.getPackageName(), 0);

    int status = NO_DOWNLOAD_REQUIRED;

    // the database automatically reads the metadata for version code
    // and download status when the instance is created
    DownloadsDB db = DownloadsDB.getDB(context);

    // we need to update the LVL check and get a successful status to
    // proceed
    if (isLVLCheckRequired(db, pi)) {
        status = LVL_CHECK_REQUIRED;
    }
    // we don't have to update LVL. do we still have a download to start?
    if (db.mStatus == 0) {
        DownloadInfo[] infos = db.getDownloads();
        if (null != infos) {
            for (DownloadInfo info : infos) {
                if (!Helpers.doesFileExist(context, info.mFileName, info.mTotalBytes, true)) {
                    status = DOWNLOAD_REQUIRED;
                    db.updateStatus(-1);
                    break;
                }
            }
        }
    } else {
        status = DOWNLOAD_REQUIRED;
    }
    switch (status) {
        case DOWNLOAD_REQUIRED:
        case LVL_CHECK_REQUIRED:
            Intent fileIntent = new Intent();
            fileIntent.setClassName(classPackage, className);
            fileIntent.putExtra(EXTRA_PENDING_INTENT, pendingIntent);
            context.startService(fileIntent);
            break;
    }
    return status;
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:65,代码来源:DownloaderService.java

示例11: startDownloadServiceIfRequired

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Starts the download if necessary. This function starts a flow that does `
 * many things. 1) Checks to see if the APK version has been checked and the
 * metadata database updated 2) If the APK version does not match, checks
 * the new LVL status to see if a new download is required 3) If the APK
 * version does match, then checks to see if the download(s) have been
 * completed 4) If the downloads have been completed, returns
 * NO_DOWNLOAD_REQUIRED The idea is that this can be called during the
 * startup of an application to quickly ascertain if the application needs
 * to wait to hear about any updated APK expansion files. Note that this
 * does mean that the application MUST be run for the first time with a
 * network connection, even if Market delivers all of the files.
 * 
 * @param context
 * @param thisIntent
 * @return true if the app should wait for more guidance from the
 *         downloader, false if the app can continue
 * @throws NameNotFoundException
 */
public static int startDownloadServiceIfRequired(Context context,
        PendingIntent pendingIntent, String classPackage, String className)
        throws NameNotFoundException {
    // first: do we need to do an LVL update?
    // we begin by getting our APK version from the package manager
    final PackageInfo pi = context.getPackageManager().getPackageInfo(
            context.getPackageName(), 0);

    int status = NO_DOWNLOAD_REQUIRED;

    // the database automatically reads the metadata for version code
    // and download status when the instance is created
    DownloadsDB db = DownloadsDB.getDB(context);

    // we need to update the LVL check and get a successful status to
    // proceed
    if (isLVLCheckRequired(db, pi)) {
        status = LVL_CHECK_REQUIRED;
    }
    // we don't have to update LVL. do we still have a download to start?
    if (db.mStatus == 0) {
        DownloadInfo[] infos = db.getDownloads();
        if (null != infos) {
            for (DownloadInfo info : infos) {
                if (!Helpers.doesFileExist(context, info.mFileName, info.mTotalBytes, true)) {
                    status = DOWNLOAD_REQUIRED;
                    db.updateStatus(-1);
                    break;
                }
            }
        }
    } else {
        status = DOWNLOAD_REQUIRED;
    }
    switch (status) {
        case DOWNLOAD_REQUIRED:
        case LVL_CHECK_REQUIRED:
            Intent fileIntent = new Intent();
            fileIntent.setClassName(classPackage, className);
            fileIntent.putExtra(EXTRA_PENDING_INTENT, pendingIntent);
            context.startService(fileIntent);
            break;
    }
    return status;
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:65,代码来源:DownloaderService.java

示例12: xAPKFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Go through each of the Expansion APK files defined in the project and
 * determine if the files are present and match the required size. Free
 * applications should definitely consider doing this, as this allows the
 * application to be launched for the first time without having a network
 * connection present. Paid applications that use LVL should probably do at
 * least one LVL check that requires the network to be present, so this is
 * not as necessary.
 *
 * @return true if they are present.
 */
boolean xAPKFilesDelivered() {
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
        if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
            return false;
    }
    return true;
}
 
开发者ID:google,项目名称:play-apk-expansion,代码行数:20,代码来源:SampleDownloaderActivity.java

示例13: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Go through each of the APK Expansion files defined in the structure above
 * and determine if the files are present and match the required size. Free
 * applications should definitely consider doing this, as this allows the
 * application to be launched for the first time without having a network
 * connection present. Paid applications that use LVL should probably do at
 * least one LVL check that requires the network to be present, so this is
 * not as necessary.
 * 
 * @return true if they are present.
 */
boolean expansionFilesDelivered() {
	for (XAPKFile xf : xAPKS) {
		String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
		if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
			return false;
	}
	return true;
}
 
开发者ID:museumsvictoria,项目名称:mv-fieldguide-android,代码行数:20,代码来源:SplashActivity.java

示例14: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Go through each of the APK Expansion files defined in the structure above
 * and determine if the files are present and match the required size. Free
 * applications should definitely consider doing this, as this allows the
 * application to be launched for the first time without having a network
 * connection present. Paid applications that use LVL should probably do at
 * least one LVL check that requires the network to be present, so this is
 * not as necessary.
 * 
 * @return true if they are present.
 */
boolean expansionFilesDelivered() {
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
        if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
            return false;
    }
    return true;
}
 
开发者ID:alebianco,项目名称:ANE-Android-Expansion,代码行数:20,代码来源:SampleDownloaderActivity.java


注:本文中的com.google.android.vending.expansion.downloader.Helpers.doesFileExist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。