Skip to content

Instantly share code, notes, and snippets.

View ggrell's full-sized avatar
:shipit:

Gyuri Grell ggrell

:shipit:
View GitHub Profile
@ggrell
ggrell / InstallReferrerReceiver.java
Last active December 31, 2017 21:48
A BroadcastReceiver for handling install referrer market broadcasts
public class InstallReferrerReceiver extends BroadcastReceiver {
private static final String TAG = "InstallReferrerReceiver";
@Override
public void onReceive(Context context, Intent intent) {
HashMap<String, String> values = new HashMap<String, String>();
try {
if (intent.hasExtra("referrer")) {
String referrers[] = intent.getStringExtra("referrer").split("&");
for (String referrerValue : referrers) {
@ggrell
ggrell / AndroidManifest.xml
Created February 21, 2012 15:59
The receiver definition in AndroidManifest.xml for your app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...>
<application ...>
<acivity ... />
<!-- Android Market install receiver -->
<receiver
android:exported="true"
android:name="com.your.namespace.InstallReferrerReceiver" >
@ggrell
ggrell / AsyncTaskExecutionHelper.java
Created May 23, 2012 14:58 — forked from greenrobot/AsyncTaskExecutionHelper.java
Helper bringing back parallel execution for AsyncTask (you are no serial execution and pseudo threading wimp, right?). Uses level 11 APIs when possible.
package de.greenrobot.util;
import java.util.concurrent.Executor;
import android.os.AsyncTask;
import android.os.Build;
/**
* Uses level 11 APIs when possible to use parallel/serial executors and falls back to standard execution if API level
* is below 11.
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
#!/bin/bash
f=$(pwd)
mkdir drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi
# fake argv and argc in bash
argc=$#; argv[0]=$0 # argv[0] is a prog name
for foo in $( seq $argc )
do
/*
* Copyright (C) 2014 Chris Banes
*
* 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
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
package net.frakbot.util.color;
import android.graphics.Color;
/**
* The MIT License (MIT)
*
* Copyright (c) 2014 Sebastiano Poggi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
//build.gradle
//fixes AndroidStudion<>RoboElectric integration
//fixes 'java.lang.RuntimeException: Stub!' and 'NoClassDefFoundError'
gradle.projectsEvaluated {
def imlFile = file(project.name + '.iml')
def parsedXml = (new XmlParser()).parse(imlFile)
def jdkNode = parsedXml.depthFirst().orderEntry.find { it.'@type' == 'jdk' }
def component = jdkNode.parent()
import groovy.transform.Field
// This is a drop-in Gradle script that allows you to easily strip out the packages you don't need
// from the Google Play Services library. The script will keep track of previous runs to prevent
// restripping each time you build.
// HOW TO USE THIS
//
// 1) Download/copy this strip_google_play_services.gradle file into the same location of your app's
// build.gradle file.