Skip to content

Instantly share code, notes, and snippets.

View felixchez's full-sized avatar

felixchez felixchez

View GitHub Profile
@er-abhishek-luthra
er-abhishek-luthra / DetectPhoneCallState.md
Last active April 26, 2024 08:10
DetectPhoneCallState.md

PhoneCallReceiver

Due to the design of Android, PhoneCallReceiver have to be a BroadcastReceiver. It can’t be a reciever registered with one app because the receiver may be run without our app being run, so we’d have to register in manifest. But I want the heavy lifting to be done by a library class(which we will be creating below)- I just want to derive from something and override a few functions. So ideally we have something like:

public abstract class PhonecallReceiver extends BroadcastReceiver {
protected void onIncomingCallStarted(Context ctx, String number, Date start);
protected void onOutgoingCallStarted(Context ctx, String number, Date start);
@JosiasSena
JosiasSena / DeCryptor.java
Last active September 12, 2023 12:40
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@jahe
jahe / gradle-cheatsheet.gradle
Last active December 8, 2022 07:22
Gradle Cheatsheet
// imports a couple of java tasks
apply plugin: "java"
// List available tasks in the shell
> gradle tasks
// A Closure that configures the sourceSets Task
// Sets the main folder as Source folder (where the compiler is looking up the .java files)
sourceSets {
main.java.srcDir "src/main"
@rostyslav
rostyslav / Client.java
Created July 7, 2011 19:58
Sample TCP client
import java.nio.*;
import java.nio.channels.*;
import java.net.*;
import java.io.*;
import java.nio.charset.*;
public class Client {
public SocketChannel client = null;