Android Open Source - CompleteActionPlus Intent Recorder Receiver






From Project

Back to project page CompleteActionPlus.

License

The source code is released under:

## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ## By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and condi...

If you think the Android project CompleteActionPlus 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 hk.valenta.completeactionplus;
//w  ww  . j  av  a  2 s. c o  m
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class IntentRecorderReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {
    // store in file
    FileOutputStream fileStream;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.UK);
    String record = String.format("%s;%s\n", dateFormat.format(new Date()), intent.getStringExtra("Intent"));
    
    try {
      fileStream = new FileOutputStream(new File(context.getFilesDir(), "record.log"), true);
      fileStream.write(record.getBytes());
      fileStream.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
    
    // toast it
    Toast.makeText(context, "Intent Recorded.", Toast.LENGTH_SHORT).show();
  }
}




Java Source Code List

hk.valenta.completeactionplus.AboutFragment.java
hk.valenta.completeactionplus.AddedFragment.java
hk.valenta.completeactionplus.AdvancedFragment.java
hk.valenta.completeactionplus.ColorPicker.java
hk.valenta.completeactionplus.DialogFragment.java
hk.valenta.completeactionplus.EnumConvert.java
hk.valenta.completeactionplus.FavoriteFragment.java
hk.valenta.completeactionplus.HiddenFragment.java
hk.valenta.completeactionplus.IntentRecorderActivity.java
hk.valenta.completeactionplus.IntentRecorderReceiver.java
hk.valenta.completeactionplus.LayoutFragment.java
hk.valenta.completeactionplus.MainPagerActivity.java
hk.valenta.completeactionplus.ManageListActivity.java
hk.valenta.completeactionplus.ManagerPagerActivity.java
hk.valenta.completeactionplus.RuleItemHelper.java
hk.valenta.completeactionplus.SelectListActivity.java
hk.valenta.completeactionplus.StartSelectedReceiver.java
hk.valenta.completeactionplus.TemporaryDefaultReceiver.java
hk.valenta.completeactionplus.TestIntentActivity.java
hk.valenta.completeactionplus.XCompleteActionPlus.java