Skip to content

Instantly share code, notes, and snippets.

View tajchert's full-sized avatar
🏠
Working from home

Michal Tajchert tajchert

🏠
Working from home
View GitHub Profile
@handstandsam
handstandsam / InstallReferrerExt.kt
Created February 28, 2022 20:29
Install Referrer KTX - Kotlin Coroutine friendly wrapper for the Google Play's InstallReferrerClient API. This API is used to ask Google Play about where the installation originated.
import android.content.Context
import android.os.RemoteException
import com.android.installreferrer.api.InstallReferrerClient
import com.android.installreferrer.api.InstallReferrerStateListener
import com.android.installreferrer.api.ReferrerDetails
import kotlinx.coroutines.CompletableDeferred
/**
* https://developer.android.com/google/play/installreferrer/library
*
@PashCracken
PashCracken / WSL-with-zsh-and-powerlevel9k.png
Last active September 4, 2023 07:28
WSL, zsh and Powerlevel10k
WSL-with-zsh-and-powerlevel9k.png

What's new in Android

BubbleApi (0:04)

  • api 29
  • What's New in the Android Os User Interface thu @ 9: 30

Dark theme (1:35)

  • in Q()
  • MODE_NIGHT_AUTO_TIME deprecated
  • OptionA - use Theme
@unoexperto
unoexperto / patch_apk_for_sniffing.md
Last active May 13, 2024 04:15
How to patch Android app to sniff its HTTPS traffic with self-signed certificate

How to patch Android app to sniff its HTTPS traffic with self-signed certificate

  • Download apktool from https://ibotpeaches.github.io/Apktool/
  • Unpack apk file: java -jar /home/expert/work/tools/apktool.jar d net.flixster.android-9.1.3@APK4Fun.com.apk
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Arinerron
Arinerron / permissions.txt
Last active June 23, 2024 19:34
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO
@tajchert
tajchert / testAmazon.java
Created October 2, 2016 00:04
Saving multiple values to DynamoDb at Amazon AWS - splitting list of items to be save so it doesn't exceed limits of one request (28, 25 is just for safety), as well with checking if there are no items left to saved - leftovers due to exceeding throughput limits. Might be useful for people working with Amazon DynamoDb and Java SDK.
private static void writeDynamoMultipleItems(ArrayList<Item> itemsBatchWrite, String tableName, DynamoDB dynamoDB) {
System.out.println("Write to DynamoDB with " + itemsBatchWrite.size() + " items");
if (itemsBatchWrite.size() > 25) {
System.out.println("Splitting table");
ArrayList<Item> writeItems = new ArrayList<>();
for (Item item : itemsBatchWrite) {
if (writeItems.size() < 25) {
writeItems.add(item);
} else {
writeDynamoMultipleItems(writeItems, tableName, dynamoDB);
@danielgomezrico
danielgomezrico / DistanceCalculator.java
Last active January 6, 2021 00:37
Java / Android - calculate the distance between two coordinates with great circle formula.
import static java.lang.Math.acos;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
/**
* Calculate distance between coordinates.
*/
public class DistanceCalculator {
static double PI_RAD = Math.PI / 180.0;
@carlonzo
carlonzo / CacheFragmentStatePagerAdapter.java
Created August 2, 2015 17:08
FragmentStatePagerAdapter that caches each pages.
/*
* Copyright 2014 Soichiro Kashima
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software