Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Workaround for new market

Change-Id: I1031b9313c8e11b5c64b03d31b547c29e87b48a0
  • Loading branch information...
commit 4383efb7e459bdd56935b03c0eeef7341d96abc8 1 parent 9ea22e9
@kmobs kmobs authored
View
4 AndroidManifest.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.teamdouche.pacman" android:versionCode="1"
- android:versionName="1.0">
+ android:versionName="1.1">
<uses-permission android:name="android.permission.SET_ALWAYS_FINISH" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name=".PacmanReciever" android:label="@string/app_name" android:exported="true" android:enabled="true">
@@ -19,7 +19,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- For testing -->
-<!-- <category android:name="android.intent.category.LAUNCHER" />-->
+ <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
</intent-filter>
</activity>
</application>
View
2  src/com/teamdouche/pacman/PacmanReciever.java
@@ -25,7 +25,9 @@
@Override
public void onReceive(Context context, Intent changed_intent) {
// TODO Auto-generated method stub
+
Log.v("Pacman", "Starting Pacman");
+
Intent intent = new Intent();
intent.setClass(context, StartupActivity.class);
intent.setAction(StartupActivity.class.getName());
View
22 src/com/teamdouche/pacman/StartupActivity.java
@@ -20,17 +20,33 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
public class StartupActivity extends Activity {
private AlertDialog alertDialog;
+ private int versionNo = 0;
+ private Intent starterIntent = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ PackageInfo pInfo = null;
+ try{
+ pInfo = getApplicationContext().getPackageManager().getPackageInfo("com.android.vending",PackageManager.GET_META_DATA);
+ } catch (NameNotFoundException e) {
+ // Market package name changed
+ pInfo = null;
+ }
+ if(pInfo != null) {
+ versionNo = pInfo.versionCode;
+ }
+ Log.v("Pacman", "Market version is " + versionNo);
// Set up the warning
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle(R.string.alert_dialog_title);
@@ -38,7 +54,11 @@ public void onCreate(Bundle savedInstanceState) {
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Log.v("Pacman", "Starting Pacman Download Activity");
- Intent starterIntent = new Intent(getApplicationContext(), DownloadActivity.class);
+ if (versionNo < 8006027) {
+ starterIntent = new Intent(getApplicationContext(), DownloadActivity.class);
+ } else {
+ starterIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Google%20Inc."));
+ }
startActivityForResult(starterIntent, 0);
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.