Android Open Source - GestureMechanism Database Commons






From Project

Back to project page GestureMechanism.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project GestureMechanism listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *// www  . j  a va  2 s .c  o  m
 * Please send inquiries to huber AT ut DOT ee
 */

package com.in.mobile.database.adcontainer;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Calendar;

/**
 * 
 * @author Huber Flores
 * 
 */

public class DatabaseCommons {

  private String outFileName;
  private static final String app_package = "com.in.mobile.gesture.ad";
  private static final String fileName = "ads-data.db";

  private String absoluteFilePath;

  public DatabaseCommons() {

  }

  public void copyDatabaseFile() throws IOException {
    absoluteFilePath = "/data/data/" + app_package + "/databases/"
        + fileName;

    InputStream myInput = new FileInputStream(absoluteFilePath);
    Calendar calendar = Calendar.getInstance();

    this.outFileName = "/sdcard/" + fileName + calendar.getTimeInMillis()
        + ".sql";
    OutputStream myOutput = new FileOutputStream(outFileName);
    byte[] buffer = new byte[1024];
    int length;
    while ((length = myInput.read(buffer)) > 0) {
      myOutput.write(buffer, 0, length);
    }
    myOutput.flush();
    myOutput.close();
    myInput.close();

    File borrar = new File(absoluteFilePath);
    borrar.delete();

  }

  public boolean fileToCopy() {
    File check = new File(absoluteFilePath);
    if (check.exists() == true) {
      return true;
    } else {
      return false;
    }
  }

  public String getDataBasePath() {
    return this.outFileName;
  }

  public void deleteDatabaseFile() {
    File borrar = new File(absoluteFilePath);
    borrar.delete();
  }
}




Java Source Code List

com.in.mobile.common.utilities.Commons.java
com.in.mobile.database.adcontainer.AdDescriptor.java
com.in.mobile.database.adcontainer.DatabaseCommons.java
com.in.mobile.database.adcontainer.DatabaseHandler.java
com.in.mobile.database.adcontainer.DatabaseHelper.java
com.in.mobile.database.adcontainer.DatabaseManager.java
com.in.mobile.gesture.ad.AdContentLoader.java
com.in.mobile.gesture.ad.AdMechanism.java
com.in.mobile.gesture.ad.DynamicAdView.java
com.in.mobile.gesture.ad.GCMIntentService.java
com.in.mobile.gesture.ad.WrapMotionEvent.java
com.in.mobile.gesture.ad.contentprovider.AdContentProvider.java
com.in.mobile.manager.adfile.FileDownloader.java
com.in.mobile.notification.handler.ServerUtilities.java
com.in.mobile.pushnotification.gcm.ApiKeyInitializer.java
com.in.mobile.pushnotification.gcm.BaseServlet.java
com.in.mobile.pushnotification.gcm.Datastore.java
com.in.mobile.pushnotification.gcm.HomeServlet.java
com.in.mobile.pushnotification.gcm.RegisterServlet.java
com.in.mobile.pushnotification.gcm.SendAllMessagesServlet.java
com.in.mobile.pushnotification.gcm.UnregisterServlet.java