This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TLSSocketFactory extends SSLSocketFactory { | |
private SSLSocketFactory internalSSLSocketFactory; | |
public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException { | |
SSLContext sslContext = SSLContext.getInstance("TLS"); | |
sslContext.init(null, new TrustManager[] { systemDefaultTrustManager() }, null); | |
internalSSLSocketFactory = sslContext.getSocketFactory(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CertificatePinner certificatePinner = new CertificatePinner.Builder() | |
.add("api.github.com", "sha256/6wJsqVDF8K19zxfLxV5DGRneLyzso9adVdUN/exDacw=") | |
.build(); | |
final OkHttpClient client = httpBuilder.certificatePinner(certificatePinner).build(); | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl(END_POINT) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.client(client) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl s_client -connect api.github.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all you need to know what parts of the library the app was actually using. This can easily be done by running the following command in your src folder. | |
grep -roh . -e 'com.google.common.*' | sort | uniq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<code_scheme name="AndroidStyle"> | |
<option name="JAVA_INDENT_OPTIONS"> | |
<value> | |
<option name="INDENT_SIZE" value="4" /> | |
<option name="CONTINUATION_INDENT_SIZE" value="8" /> | |
<option name="TAB_SIZE" value="8" /> | |
<option name="USE_TAB_CHARACTER" value="false" /> | |
<option name="SMART_TABS" value="false" /> | |
<option name="LABEL_INDENT_SIZE" value="0" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IDEA/Android Studio ignores | |
*.iml | |
*.ipr | |
*.iws | |
**/.idea/workspace.xml | |
**/.idea/tasks.xml | |
**/.idea/datasources.xml | |
**/.idea/dataSources.ids | |
**/.idea/gradle.xml | |
**/.idea/misc.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget http://repo.gradle.org/gradle/distributions/gradle-1.0-bin.zip | |
--2011-03-18 10:58:46-- http://repo.gradle.org/gradle/distributions/ | |
gradle-1.0-bin.zip | |
Resolving repo.gradle.org... 50.16.203.43 | |
Connecting to gradle.artifactoryonline.com |50.16.203.43|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 26899590 (26M) [application/zip] | |
Saving to: `gradle-1.0-bin.zip' | |
100%[=============================================================>] | |
26,899,590 171K/s in 2m 56s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: First Tag Id to ImageView | |
imageview.setImageBitmap( | |
decodeSampledBitmapFromResource(getResources(), R.drawable.adnuentrancecrop, 350, 100)); | |
imageview.setTag(R.drawable.adnuentrancecrop); | |
//TODO: Onclick you can extract the ID | |
imageview.setOnClickListener( | |
new View.OnClickListener() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rooting is not required. With USB cable connected, port 5555 opened across all involved firewalls and debug mode enabled | |
adb tcpip 5555 | |
then look into wireless properties of your device and the network you use, to see which IP address have been granted to device (or configure your DHCP always to use the same for the device mac address). Then | |
adb connect 192.168.1.133 | |
(were 192.168.1.133 is a sample IP address). | |
This is all. You can now use adb shell or adb install or adb upload or the like with USB cable plugged out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OkHttpClient client = new OkHttpClient(); | |
client.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); | |
Picasso picasso = new Picasso.Builder(this).listener(new Picasso.Listener() { | |
@Override | |
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) { | |
LogUtils.LOGD(TAG, "Exception URL " + exception.getMessage()); | |
exception.printStackTrace(); | |
} | |
}) .downloader(new OkHttpDownloader(client)).build(); |