Skip to content

Commit

Permalink
Implements generic app event logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
audaciouscode committed Mar 11, 2017
1 parent 2df6c74 commit 9b7c5ca
Show file tree
Hide file tree
Showing 4 changed files with 452 additions and 2 deletions.
4 changes: 4 additions & 0 deletions res/values/databases.xml
Expand Up @@ -12,4 +12,8 @@

<!-- Phone Calls Generator -->
<string name="pdk_generator_text_messages_create_history_table">CREATE TABLE history(_id INTEGER PRIMARY KEY AUTOINCREMENT, fetched INTEGER, transmitted INTEGER, observed INTEGER, direction TEXT, length INTEGER, body TEXT, number_name TEXT, number TEXT);</string>

<!-- App Events Generator -->
<string name="pdk_generator_app_events_create_history_table">CREATE TABLE history(_id INTEGER PRIMARY KEY AUTOINCREMENT, fetched INTEGER, transmitted INTEGER, observed INTEGER, event_name TEXT, event_details TEXT);</string>

</resources>
11 changes: 9 additions & 2 deletions src/com/audacious_software/passive_data_kit/Logger.java
Expand Up @@ -2,16 +2,23 @@

import android.content.Context;

import com.audacious_software.passive_data_kit.generators.diagnostics.AppEvent;

import java.util.HashMap;
import java.util.Map;

/**
* Created by cjkarr on 4/3/2016.
*/
public class Logger {
private Context mContext = null;

public void log(String event, HashMap<String, Object> details) {
// TODO
public void log(String event, Map<String, ? extends Object> details) {
if (details == null) {
details = new HashMap<>();
}

AppEvent.getInstance(this.mContext).logEvent(event, details);
}

private static class LoggerHolder {
Expand Down
Expand Up @@ -11,6 +11,7 @@

import com.audacious_software.passive_data_kit.Logger;
import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction;
import com.audacious_software.passive_data_kit.generators.diagnostics.AppEvent;
import com.audacious_software.pdk.passivedatakit.R;

import java.lang.reflect.InvocationTargetException;
Expand All @@ -37,6 +38,8 @@ public void start() {
{
this.mGenerators.clear();

this.mGenerators.add(AppEvent.class.getCanonicalName());

for (String className : this.mContext.getResources().getStringArray(R.array.pdk_available_generators))
{
this.mGenerators.add(className);
Expand Down

0 comments on commit 9b7c5ca

Please sign in to comment.