Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Workaround for new market

Change-Id: I1031b9313c8e11b5c64b03d31b547c29e87b48a0
  • Loading branch information...
commit 4383efb7e459bdd56935b03c0eeef7341d96abc8 1 parent 9ea22e9
Keyan Mobli authored August 23, 2011
4  AndroidManifest.xml
... ...
@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3
 	package="com.teamdouche.pacman" android:versionCode="1"
4  
-	android:versionName="1.0">
  4
+	android:versionName="1.1">
5 5
 	<uses-permission android:name="android.permission.SET_ALWAYS_FINISH" />
6 6
 	 <application android:icon="@drawable/icon" android:label="@string/app_name">
7 7
         <receiver android:name=".PacmanReciever" android:label="@string/app_name" android:exported="true" android:enabled="true">
@@ -19,7 +19,7 @@
19 19
 			<intent-filter>
20 20
 			        <action android:name="android.intent.action.MAIN" />
21 21
 				<!-- For testing -->
22  
-<!--				<category android:name="android.intent.category.LAUNCHER" />-->
  22
+			        <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
23 23
 			</intent-filter>
24 24
 		</activity>
25 25
 	</application>
2  src/com/teamdouche/pacman/PacmanReciever.java
@@ -25,7 +25,9 @@
25 25
     @Override
26 26
     public void onReceive(Context context, Intent changed_intent) {
27 27
         // TODO Auto-generated method stub
  28
+
28 29
         Log.v("Pacman", "Starting Pacman");
  30
+
29 31
         Intent intent = new Intent();
30 32
         intent.setClass(context, StartupActivity.class);
31 33
         intent.setAction(StartupActivity.class.getName()); 
22  src/com/teamdouche/pacman/StartupActivity.java
@@ -20,17 +20,33 @@
20 20
 import android.app.AlertDialog;
21 21
 import android.content.DialogInterface;
22 22
 import android.content.Intent;
  23
+import android.content.pm.PackageInfo;
23 24
 import android.content.pm.PackageManager;
  25
+import android.content.pm.PackageManager.NameNotFoundException;
  26
+import android.net.Uri;
24 27
 import android.os.Bundle;
25 28
 import android.util.Log;
26 29
 
27 30
 public class StartupActivity extends Activity {
28 31
     private AlertDialog alertDialog;
  32
+    private int versionNo = 0;
  33
+    private Intent starterIntent = null;
29 34
 
30 35
     @Override
31 36
     public void onCreate(Bundle savedInstanceState) {
32 37
         super.onCreate(savedInstanceState);
  38
+        PackageInfo pInfo = null;
  39
+        try{
  40
+            pInfo = getApplicationContext().getPackageManager().getPackageInfo("com.android.vending",PackageManager.GET_META_DATA);
  41
+        } catch (NameNotFoundException e) {
  42
+            // Market package name changed
  43
+            pInfo = null;
  44
+        }
  45
+        if(pInfo != null) {
  46
+            versionNo = pInfo.versionCode;
  47
+        }
33 48
 
  49
+        Log.v("Pacman", "Market version is " + versionNo);
34 50
         // Set up the warning
35 51
         alertDialog = new AlertDialog.Builder(this).create();
36 52
         alertDialog.setTitle(R.string.alert_dialog_title);
@@ -38,7 +54,11 @@ public void onCreate(Bundle savedInstanceState) {
38 54
         alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() {
39 55
             public void onClick(DialogInterface dialog, int which) {
40 56
                 Log.v("Pacman", "Starting Pacman Download Activity");
41  
-                Intent starterIntent = new Intent(getApplicationContext(), DownloadActivity.class);
  57
+                if (versionNo < 8006027) {
  58
+                    starterIntent = new Intent(getApplicationContext(), DownloadActivity.class);
  59
+                } else {
  60
+                    starterIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Google%20Inc."));
  61
+                }
42 62
                 startActivityForResult(starterIntent, 0);
43 63
                 return;
44 64
             }

0 notes on commit 4383efb

Please sign in to comment.
Something went wrong with that request. Please try again.