Skip to content

Instantly share code, notes, and snippets.

View DavidTPate's full-sized avatar

David Pate DavidTPate

  • Denver
View GitHub Profile
public class PhoneStateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Check phone state
String currentPhoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
// If the phone is ringing
if (currentPhoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
// If the phone is already in a call, ignore this call.
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
public class PhoneAnswerIntentService extends IntentService {
/**
* Creates an IntentService. Invoked by the parent class's constructor.
*/
public PhoneAnswerIntentService() {
super("PhoneAnswerIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wemakestuff.autoanswer"
android:versionCode="1"
android:versionName="0.1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
([]+[][+[]])[+!+[]+!+[]+!+[]+!+[]+!+[]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]](([]+!![])[+!+[]]+([]+[][+[]])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]+!+[]]+([]+!![])[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+
@DavidTPate
DavidTPate / Express-Morgan-JSON.js
Last active July 27, 2023 13:53
A gist which shows how to run Morgan in Express with output in JSON
const express = require('express');
const app = express();
const morgan = require('morgan');
const port = 3000;
// Define your morgan logger to log JSON to your client
// The object here takes your keys and strings that use
// the morgan token format
app.use(morgan(format({
response_time: ':response-time',