Android Open Source - Interception write2file






From Project

Back to project page Interception.

License

The source code is released under:

# The Code Project Open License (CPOL) 1.02 ###Preamble This License governs Your use of the Work. This License is intended to allow developers to use the Source Code and Executable Files provided a...

If you think the Android project Interception 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

package com.sparsa.write2file;
//ww w  .j a va  2 s .co m
import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

/**
 * Created by Jared on 10/29/2014.
 * Purpose: find internal storage to write secret log to.
 * http://androiddesk.wordpress.com/2012/08/02/blocking-a-call-without-user-intervention-in-android/
 *
 */
public class write2file {

    Context ctx;
    private String TAG = "Write2file: ";


    public void writeToFile(String data) {

        try {
            File covLog= new File("/sdcard/secret.log");
            covLog.createNewFile();
            FileOutputStream fOut = new FileOutputStream(covLog);
            OutputStreamWriter writer = new OutputStreamWriter(fOut);
            writer.append(data);
            Log.v(TAG, "Successfully wrote: " + data);
            writer.close();
            fOut.close();
        } catch (Exception e) {
            Log.v(TAG, "Error occurred in writeToFile: " + e);
        }





    }


}




Java Source Code List

com.bitgriff.androidcalls.Block.java
com.bitgriff.androidcalls.BuildConfig.java
com.bitgriff.androidcalls.BuildConfig.java
com.bitgriff.androidcalls.CallDetectService.java
com.bitgriff.androidcalls.CallHelper.java
com.bitgriff.androidcalls.MainActivity.java
com.sparsa.write2file.write2file.java