AI2 Component  (Version nb184)
ReplApplication.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2009-2011 Google, All Rights reserved
3 // Copyright 2011-2012 MIT, All rights reserved
4 // Released under the Apache License, Version 2.0
5 // http://www.apache.org/licenses/LICENSE-2.0
6 package com.google.appinventor.components.runtime;
7 
8 import android.app.Application;
9 import android.content.Context;
10 import android.util.Log;
11 import com.google.appinventor.common.version.GitBuildId;
15 
16 import org.acra.*;
17 import org.acra.annotation.*;
18 
31 @ReportsCrashes(formKey="")
32 public class ReplApplication extends Application {
33 
34  private boolean active = false;
35  private static ReplApplication thisInstance;
36  // the installed variable tells us whether or
37  // not we have successfully installed the additional
38  // dex files, including the DexOpt pass.
39  // we default to true because in a non-Companion
40  // context this module isn't used, but is still
41  // consulted. The Application used in non-Companion
42  // apps is MultiDexApplication which will always
43  // do the full install if it is needed.
44  public static boolean installed = true;
45 
46  @Override
47  protected void attachBaseContext(Context base) {
48  super.attachBaseContext(base);
49  // Note: We call this with "false" which will only
50  // splice in the secondary dex files if it doesn't
51  // have to load the files and run the expensive
52  // DexOpt pass. If DexOpt is required, then it
53  // will be done in Form.onCreate()
54  // Note: We only do this dance for the Companion
55  installed = MultiDex.install(this, false);
56  }
57 
58  @Override
59  public void onCreate() {
60  super.onCreate();
61  thisInstance = this;
62  String acraUri = GitBuildId.getAcraUri();
63  if (acraUri.equals("")) {
64  Log.i("ReplApplication", "ACRA Not Active");
65  } else {
66  Log.i("ReplApplication", "ACRA Active, URI = " + acraUri);
67  ACRAConfiguration config = ACRA.getNewDefaultConfig(this);
68  config.setFormUri(acraUri);
69  config.setDisableSSLCertValidation(true); // So we can use an MIT or self signed cert
70  ACRA.setConfig(config); // On the server.
71  ACRA.init(this);
72  active = true;
73  }
74  }
75 
76  public static void reportError(Throwable ex, String reportId) {
77  ACRA.getErrorReporter().putCustomData("reportid", reportId);
78  reportError(ex);
79  }
80 
81  public static void reportError(Throwable ex) {
82  if (thisInstance != null && thisInstance.active)
83  ACRA.getErrorReporter().handleException(ex);
84  }
85 
86  public static boolean isAcraActive() {
87  if (thisInstance != null && thisInstance.active) {
88  return true;
89  } else {
90  return false;
91  }
92  }
93 }
com.google.appinventor.components.runtime.multidex.MultiDex
Definition: MultiDex.java:57
com.google.appinventor.components.runtime.ReplApplication.attachBaseContext
void attachBaseContext(Context base)
Definition: ReplApplication.java:47
com.google.appinventor.components.runtime.multidex
Definition: MultiDex.java:17
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components
com.google.appinventor.components.runtime.ReplApplication.isAcraActive
static boolean isAcraActive()
Definition: ReplApplication.java:86
com.google.appinventor.components.runtime.ReplApplication.reportError
static void reportError(Throwable ex, String reportId)
Definition: ReplApplication.java:76
com.google.appinventor.components.runtime.util.SdkLevel
Definition: SdkLevel.java:19
com.google.appinventor.components.runtime.ReplApplication.reportError
static void reportError(Throwable ex)
Definition: ReplApplication.java:81
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.ReplApplication
Definition: ReplApplication.java:32
com.google
com
com.google.appinventor.components.runtime.ReplApplication.onCreate
void onCreate()
Definition: ReplApplication.java:59
com.google.appinventor.components.runtime.multidex.MultiDex.install
static boolean install(Context context, boolean doIt)
Definition: MultiDex.java:94
com.google.appinventor.components.runtime.util.EclairUtil
Definition: EclairUtil.java:31
com.google.appinventor