Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4345388
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:01:45+00:00 2026-05-21T12:01:45+00:00

I am planning to automate the testing of an application by creating a log

  • 0

I am planning to automate the testing of an application by creating a log to store some results of execution of the app and latter on parse it using a piece of python code and plot a graph.

The application is a WiFi fingerprinter i.e it collects info such as mac id, rss(recieved signal strength and rank(normalized rss) about the wifi devices in the surrounding environment. So to test this application I would have to take it to the location and record the results(as of now manually). So logcat wouldn’t serve the purpose.

Automation requires
1. Storing the log in the device
2. Access to the log file in the system through usb

Format of the Log file:

Snapshot: 1
Fingerprint: 1, Rank: 0.23424, Boolean: true
Fingerprint: 2, Rank: 0.42344, Boolean: false
Fingerprint: 3, Rank: 0.23425, Boolean: true

Snapshot: 2
Fingerprint: 1, Rank: 0.75654, Boolean: false
Fingerprint: 2, Rank: 0.23456, Boolean: true
Fingerprint: 3, Rank: 0.89423, Boolean: true 

................

Now I know there are basically 3 approaches for persistent storage(SharedPrefs wouldn’t suit this scenario anyway). I tried Internal Storage, but even after setting the mode of the file as MODE_WORLD_READABLE it was impossible to read the file using Device File Explorer in Eclipse.

I am still wary of using external storage for storing the log. Any tutorial on how to write to a file in usb of the device will definitely help.

I thought of structuring the data to be stored so as to use SQLite for storage. But this establishing many unnecessary relations(foreign and domestic) between data and make it complex. If there is no way around, then here be dragons.

Basically I want to write to a file(easier I suppose) in the device and latter on read it in my system by connecting to it via usb. Any help on how to do it would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:01:46+00:00Added an answer on May 21, 2026 at 12:01 pm

    Wary or not, External Storage still may be the only way to go. Without root access on the device, you can’t really get at anything “Internal” unless you’re going to be okay with reading within an application on the device. The docs provide pretty solid guidelines for where to create external files, and if you are using API Level 8 or higher, there are a couple of extra functions that can be used. I’m sure you know this page, but here it is anyway: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

    If you’re in need of any file io example code… I think I could dig some up…

    EDIT – I would start by following the guidelines in the above docs to first confirm the state of the storage. I unfortunately don’t have any experience with appending a file in Java, so someone else would definitely be more qualified to answer. This doesn’t cover appending, but I have a backup routine in one of my personal apps that looks something like this.

        File backupPath = Environment.getExternalStorageDirectory();
    
        backupPath = new File(backupPath.getPath() + "/Android/data/com.maximusdev.bankrecord/files");
    
        if(!backupPath.exists()){
            backupPath.mkdirs();
        }
    
        FileOutputStream fos;
        try {
            fos = new FileOutputStream(backupPath.getPath() + "/recordsbackup.txt");
    
            if(okaytowrite){
                for(int i = 0; i < count; ++i){
                    entry = adapter.getItem(i);
                    fos.write(entry.toString().getBytes());
                    fos.write("\n".getBytes());
                    fos.write(String.valueOf(entry.dateTime).getBytes());
                    fos.write("\n".getBytes());
                    fos.write(String.valueOf(entry.sign).getBytes());
                    fos.write("\n".getBytes());
                    fos.write(String.valueOf(entry.cleared).getBytes());
                    fos.write("\n".getBytes());
                    fos.write(String.valueOf(entry.transDate).getBytes());
                    fos.write("\n".getBytes());
                    fos.write(entry.category.getBytes());
                    fos.write("\n".getBytes());
                }
            }
            fos.close();
    
            Toast.makeText(this, "Backup Complete", Toast.LENGTH_SHORT).show();
    
        } catch (FileNotFoundException e) {
    
            e.printStackTrace();
    
            AlertDialog.Builder delmessagebuilder = new AlertDialog.Builder(this);
    
            delmessagebuilder.setCancelable(false);
    
            delmessagebuilder.setMessage("File Access Error");
    
            delmessagebuilder.setNeutralButton("Okay", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
    
            delmessagebuilder.create().show();
    
        } catch (IOException e) {
    
            e.printStackTrace();
    
            AlertDialog.Builder delmessagebuilder = new AlertDialog.Builder(this);
    
            delmessagebuilder.setCancelable(false);
    
            delmessagebuilder.setMessage("File Access Error");
    
            delmessagebuilder.setNeutralButton("Okay", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
    
            delmessagebuilder.create().show();
        }
    

    Once I’m ready to write, I’m pulling a custom object (entry) out of an ArrayAdapter (adapter) and converting field valuse to strings and using getBytes() to pass to the FileOutputStream write function. I’ve done some research and there are quite a few other options for file writing in Java/Android… the FileWriter Class for instance, so it bears further research.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are planning to automate the different plug-ins available in a Word document. Using
I am planning on making an application which automates some taks for me, these
Am planning on using declarative authorization in a Rails 3 app. I have the
Am planning on using declarative authorization in a Rails 3 app. I have the
I'm planning to do some data mining on my django app which uses appengine
Im planning on using ASIHTTP to handle some long file downloads/installs and I'd like
While doing planning sessions using Rapid Board what are some reasonable ways to make
I'm planning to build a web-app to do automated quizzing for some language classes
Planning to create a new website for our product using ASP.NET MVC 4. Site
Currently planning on making the installation process for a .NET application I'm selling smoother

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.