Exemple #1
0
 /**
  * Check if external storage is built-in or removable.
  *
  * @return True if external storage is removable (like an SD card), false otherwise.
  */
 @TargetApi(9)
 public static boolean isExternalStorageRemovable() {
   if (Android.isAPI(9)) {
     return Environment.isExternalStorageRemovable();
   }
   return true;
 }
 // Local URL : http://localhost:8080/updateLeaderboardLevel?accountId=test
 @RequestMapping("/updateLeaderboardLevel")
 public String updateLeaderboardLevel(
     @RequestParam(value = "accountId", defaultValue = "0000") String accountId,
     @RequestParam(value = "level", defaultValue = "0000") String level)
     throws SQLException {
   return and.updateLeaderboardLevel(accountId, level);
 }
 /**
  * Called when the application is created. Override this method to initialize our application
  * singleton and to create and initialize any application state variables or shared resources.
  */
 @Override
 public void onCreate() {
   super.onCreate();
   {
     Debug.print("create");
   }
 }
  // Local URL :
  // http://localhost:8080/usePowerUp?accountId=testDumby&powerUp=Fire
  @RequestMapping("/usePowerUp")
  public String usePowerUp(
      @RequestParam(value = "accountId", defaultValue = "0000") String accountId,
      @RequestParam(value = "powerUp", defaultValue = "0000") String powerUp)
      throws SQLException {

    return and.usePowerUp(accountId, powerUp);
  }
 /**
  * Called when a background process have already been terminated and the current foreground
  * applications are still low on memory. Override this method to clear caches or release
  * unnecessary resources.
  */
 @Override
 public void onLowMemory() {
   super.onLowMemory();
   {
     Debug.print("lowMemory");
     DatabaseSession.close(); // to free buffers
   }
 }
 /**
  * Called when the application object is terminated. There is no guarantee of this method being
  * called.
  */
 @Override
 public void onTerminate() {
   {
     Debug.print("terminate");
     DatabaseSession.close();
   }
   super.onTerminate();
 }
Exemple #7
0
  /**
   * Get the external app cache directory.
   *
   * @param context The context to use
   * @return The external cache dir
   */
  @TargetApi(8)
  public static File getExternalCacheDir(Context context) {
    // Do we have a built-in external cache dir method.
    if (Android.isAPI(8)) {
      File cacheDir = context.getExternalCacheDir();
      if (cacheDir != null) {
        return cacheDir;
      }
    }

    // Before Froyo we need to construct the external cache dir ourselves
    final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/";
    return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir);
  }
 /**
  * Override this function if it is necessary to handle configuration changes at an application
  * level.
  *
  * @param newConfig new configuration.
  */
 @Override
 public void onConfigurationChanged(final Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   {
     Debug.enter();
     try {
       Debug.print("configurationChanged", newConfig.locale);
       Android.App.setLocale(newConfig.locale);
     } catch (IOException ex) {
       Debug.error(ex, "unable to set new locale", newConfig.locale);
     }
     Debug.leave();
   }
 }
 // Local URL : http://localhost:8080/checkPowerUp?accountId=testDumby
 @RequestMapping("/checkPowerUp")
 public String checkPowerUps(
     @RequestParam(value = "accountId", defaultValue = "0000") String accountId)
     throws SQLException {
   return and.checkPowerUps(accountId);
 }