Skip to content

Instantly share code, notes, and snippets.

View sreereddymenon's full-sized avatar

Sree Reddy Menon sreereddymenon

  • Chicago
View GitHub Profile
@sreereddymenon
sreereddymenon / android-adb-pull-apk.md
Created September 24, 2019 19:33 — forked from ctrl-freak/android-adb-pull-apk.md
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

@sreereddymenon
sreereddymenon / Rover.java
Created September 8, 2019 23:34 — forked from cloudbank/Rover.java
Mars rover given a list of String cmds in an nxn matrix, return the square you end on.
public class Rover {
public static int roverMove(int matrixSize, List<String> cmds) {
int result = 0;
for (int i = 0; i < cmds.size(); i++) {
result = process(cmds.get(i), matrixSize, result);
}
return result;
}
static int process(String cmd, int n, int current) {
@sreereddymenon
sreereddymenon / app-module-build.gradle
Created September 9, 2016 12:12 — forked from segunfamisa/app-module-build.gradle
Using gradle extra properties to manage Android dependency versioning
// app module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.segunfamisa.gradleextraproperties"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
@sreereddymenon
sreereddymenon / gist:cfaf834463c71c4af89b87a06e5cefab
Last active September 29, 2016 11:34
awesome Datascience Links
http://dataconomy.com/a-beginners-guide-to-big-data-terminology/
http://dataconomy.com/10-online-big-data-courses-2016/
http://datascienceacademy.com/free-data-science-courses/
http://www.kdnuggets.com/education/usa-canada.html
http://www.learndatasci.com/best-data-science-online-courses/
@sreereddymenon
sreereddymenon / proguard rules
Created August 22, 2016 20:23
proguard usage
So you have a library defined and you want to run proguard on it when building it to remove unused code and to obfuscate code. Of course you do not want to remove or obfuscate classes/interfaces/enums/methods/fields that are public since these will be called on by the projects that depend on your library.
Here are the rules that you need in your proguard config file:
-keepparameternames
-keep public interface com.mycompany.mylibrary.** {
<methods>;
}
@sreereddymenon
sreereddymenon / gradle_task_grant_permission
Created June 11, 2016 18:39 — forked from fangzhzh/gradle_task_grant_permission
gradle task to grant permission to device
android.applicationVariants.all { variant ->
def applicationId = variant.applicationId
def adb = androidadbExe. as String
def variantName = variant.name.capitalize()
def grantPermissionTask = task.create("create${variantName}Permissions") << {
"${adb} devices".execute().text.eachLine {
if(it.endsWith("device")){
def device = it.split()[0]
println "Granting permissions on devices ${device}"
"${adb} -s ${devices} shell pm grant ${applicationId} android.permission.ACCESS_FINE_LOCATION".execute()
@sreereddymenon
sreereddymenon / CustomRecyclerViewAdapter.java
Last active May 4, 2016 18:58 — forked from frapontillo/CustomRecyclerViewAdapter.java
How to use SwitchCompat inside a RecyclerView item
// omissis
@Override
public void onBindViewHolder(final CustomViewHolder holder, final int position) {
holder.mSwitch.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, final boolean isChecked) {
// TODO: handle your switch toggling logic here
}
@sreereddymenon
sreereddymenon / 1_drawable_ic_hash_io16.xml
Created March 21, 2016 13:53 — forked from nickbutcher/1_drawable_ic_hash_io16.xml
Animated Stroke. The google I/O website this year (https://google.com/io) has some funky animated lettering. I especially liked the animated stroke around the letters and wondered how you might implement that on Android. Turns out that AnimatedVectorDrawable makes this very easy! Here's how it looks: https://twitter.com/crafty/status/71077957997…
<?xml version="1.0" encoding="utf-8"?>
<!--
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
<resources>
<style name="AppTheme" parent="AppBaseTheme">
<!-- Extends the base theme below -->
</style>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
@sreereddymenon
sreereddymenon / Android useful articles .txt
Last active March 2, 2016 18:30
Android Useful Articles.
1 .Recyclerview Item Decoration.
https://www.bignerdranch.com/blog/a-view-divided-adding-dividers-to-your-recyclerview-with-itemdecoration/
2. android-data-sync- sync Adapter
http://chariotsolutions.com/blog/post/android-data-sync/
https://software.intel.com/en-us/android/articles/handling-offline-capability-and-data-sync-in-an-android-app-part-2
http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter