Skip to content

Instantly share code, notes, and snippets.

override fun onShowSendLogsDialog(stringPair: Pair<Array<String>, String>?) {
val emailTo = "[email protected]"
val emailSubj = "Subject"
val chooserTitle = "Title"
val fileNames: List<String>? = stringPair?.first?.toList()
sendEmail(this, fileNames, emailTo, emailSubj, chooserTitle, stringPair?.second ?: "")
}
private fun sendEmail(ctx: Context, fileNames: List<String>?,
emailTo: String, emailSubj: String, chooserTitle: String,
public static void collectFiles(String fileName,
LogsFilenameFilter filter) {
final File cache = App.getAppContext().getCacheDir();
final File[] files;
if (cache != null && cache.exists() && cache.isDirectory()
&& (files = cache.listFiles(filter)) != null
&& files.length > 0) {
File targetLocation = new File(cache, fileName);
try {
public class CollectLogsTask extends AsyncTask<Void, Integer, Pair<String[], String>>{
private OnSendLogsDialogListener mListener;
public static final String LOGS_ZIP_FILE_NAME = "logs.zip";
public CollectLogsTask(Activity activity, OnSendLogsDialogListener listener) {
mListener = listener;
}
@Override
protected Pair<String[], String> doInBackground(Void... params) {
public static FileOutputStream getLogFileStream() {
if (mLogFile != null) {
try {
mLogFileStream = new FileOutputStream(mLogFile);
} catch (IOException e) {
e.printStackTrace();
}
}
return mLogFileStream;
}
public static final String ANDROID_MANUAL_CLIENT_LOG = "app.log";
public static File prepareLogFile() {
File f = null;
try {
f = new File(getCachePath(),
ANDROID_MANUAL_CLIENT_LOG);
if (f.exists()) {
f.delete();
}
f = new File(getCachePath(),
public class LogcatHelper {
private static final long THREAD_DELAY = 1000;
private static final String[] PROC_ARRAY = new String[]{"logcat", "-v",
"threadtime"};
private final AtomicBoolean saveSystemLog = new AtomicBoolean(false);
private final AtomicBoolean prepareNewLogFile = new AtomicBoolean(false);
private Thread mLogCheckThread;
private final Runnable logcatRunnable = new Runnable() {
private final byte[] buf = new byte[10240];
@TheDanileron
TheDanileron / AndroidManifest.xml
Created March 3, 2019 13:48 — forked from bjoernQ/AndroidManifest.xml
Creating a System Overlay (Always on Top over all Apps) in Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
@TheDanileron
TheDanileron / Adb stuff
Last active September 24, 2018 13:08 — forked from ckurtm/AndroidManifest.xml
Example on how to use adb to start an Activity,BroadcastReceiver or Service from adb and include intent extras too.for Activity: adb shell am start -n "com.peirr.test/com.peirr.test.MyActivity" --es name "John" --ei age 30for BroadcastReceiver adb shell am broadcast -n "com.peirr.test/com.peirr.test.MyReceiver" --es name "John" --ei age 30for Se…
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.peirr.test">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<?php
// extension=php_oci8_12c.dll must be uncommented in php.ini
$c = oci_connect('v8train', 'train', 'localhost/xe');
if (!$c) {
$m = oci_error();
trigger_error('Could not connect to database: ' . $m['message'], E_USER_ERROR);
}
$s = oci_parse($c, "SELECT * FROM TEST");
if (!$s) {
$m = oci_error($c);
ini_set("log_errors", 1);
ini_set("error_log", "logs.log");
error_log("Logs!");