add and use isGooglePlayApp()

This commit is contained in:
Eric House 2014-01-23 07:47:32 -08:00
parent 710f9c68ff
commit e72beaa265
2 changed files with 14 additions and 4 deletions

View file

@ -108,12 +108,12 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
JSONObject params = new JSONObject();
PackageManager pm = context.getPackageManager();
String packageName = context.getPackageName();
String installer = pm.getInstallerPackageName( packageName );
if ( "com.google.android.feedback".equals( installer )
|| "com.android.vending".equals( installer ) ) {
// Do nothing; it's a Market app
if ( Utils.isGooglePlayApp( context ) ) {
// Do nothing
} else {
String installer = pm.getInstallerPackageName( packageName );
try {
int versionCode = pm.getPackageInfo( packageName, 0 ).versionCode;

View file

@ -464,6 +464,16 @@ public class Utils {
return result;
}
public static boolean isGooglePlayApp( Context context )
{
PackageManager pm = context.getPackageManager();
String packageName = context.getPackageName();
String installer = pm.getInstallerPackageName( packageName );
boolean result = "com.google.android.feedback".equals( installer )
|| "com.android.vending".equals( installer );
return result;
}
private static void setFirstBootStatics( Context context )
{
int thisVersion = getAppVersion( context );