/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2123 by torben, Wed Mar 5 12:11:16 2014 UTC revision 2124 by torben, Wed Mar 5 21:02:04 2014 UTC
# Line 21  import android.view.Window; Line 21  import android.view.Window;
21  import android.widget.Button;  import android.widget.Button;
22  import android.widget.Toast;  import android.widget.Toast;
23    
 import com.example.android.trivialdrivesample.util.IabHelper;  
 import com.example.android.trivialdrivesample.util.IabResult;  
24  import com.nullwire.trace.ExceptionHandler;  import com.nullwire.trace.ExceptionHandler;
25    
26  import dk.thoerup.androidutils.CheckUpdates;  import dk.thoerup.androidutils.CheckUpdates;
# Line 44  public class WelcomeScreen extends Activ Line 42  public class WelcomeScreen extends Activ
42                  ListFavorites                  ListFavorites
43          }          }
44                    
         IabHelper mHelper;  
45                    
46          Handler handler = new Handler();          Handler handler = new Handler();
47                    
# Line 129  public class WelcomeScreen extends Activ Line 126  public class WelcomeScreen extends Activ
126                  }                  }
127                                    
128                                    
                 try {  
                         initBilling();  
                 } catch (Exception e) {  
                         //Do nothing - just don't crash if billing failed to initialize  
                 }  
   
   
129          }          }
130                    
         private void initBilling() {  
                 String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAln3XRJzM8Eo/SSMBLzSOj9pLedftZrWONRLO9KC/BU1Bv0EK3PQhza1S6apS69fa300ZitKSB91WDkf88eW4VJq8txmq8W1J2x/WJCFRQnFaPP0pDgERo9EdEULH2ybsOape/7+ypqNaDWxuqBh4fQfAd+Qpgdz8E7y5ZNbIKqJnRn2gyEfpzytiNQKNATI+XxJfyrS7urg/u/hXYw1R7VBNoAO7KU3b4D205WtXBn2u+Zexjd5disVGmZ5jd0BiuVOyPIWK5e9tA/VnKl/6XDfB9utCtXcAWFVUoVE6+8HWwo9ugFauuwYmbl6pTZydPKjyh9WxVR5MS2TPue/wEwIDAQAB";  
   
                 // compute your public key and store it in base64EncodedPublicKey  
                 mHelper = new IabHelper(this, base64EncodedPublicKey);  
                 mHelper.enableDebugLogging(true);  
                   
                 mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {  
                         public void onIabSetupFinished(IabResult result) {  
   
                                 Log.d("TrainInfo", "onIabSetupFinished");  
   
                                 if (!result.isSuccess()) {  
                                         // Oh noes, there was a problem.  
                                         Log.d("TrainInfo", "Problem setting up In-app Billing: " + result);  
                                 }              
                                 // Hooray, IAB is fully set up!    
                         }  
                 });  
           
         }  
   
131    
132    
133          @Override          @Override
# Line 168  public class WelcomeScreen extends Activ Line 136  public class WelcomeScreen extends Activ
136                  if (stationLoader != null) {                  if (stationLoader != null) {
137                          stationLoader.cancel(true);                          stationLoader.cancel(true);
138                          stationLoader = null;                          stationLoader = null;
139                  }                  }              
                 if (mHelper != null) {  
                         try {  
                                 mHelper.dispose();  
                         } catch (Exception e) {  
                                 //Do Nothing  
                         }  
                         mHelper = null;  
                 }  
                   
140                                    
141                  ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup                  ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup
142          }          }

Legend:
Removed from v.2123  
changed lines
  Added in v.2124

  ViewVC Help
Powered by ViewVC 1.1.20