Skip to content

Commit

Permalink
Add support for debugging with Charles Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
realityexpander committed May 14, 2018
1 parent f37341e commit 1a465e1
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private ArrayList<Venue> findVenues(String searchString) {

if(response.body() == null) {
try {
// Get the error message from Foursquare server
JSONObject jObjError = new JSONObject(response.errorBody().string());

Toast.makeText(mContext, ((JSONObject)jObjError.get("meta")).getString("errorDetail"), Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_LONG).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.

frsResults = (ArrayList<FoursquareResults>)savedInstanceState.getSerializable("frsResults");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class PlacePickerAdapter extends RecyclerView.Adapter<PlacePickerAdapter.

private static final double AUSTIN_TX_LATITUDE = 30.2672;
private static final double AUSTIN_TX_LONGITUDE = -97.7431;

private static final int FIRST_CATEGORY = 0;

// The list of frsResults from the Foursquare API
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_height="50dp"
android:layout_marginBottom="28dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/imageView3"
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/raw/charles_ssl_proxying_certificate
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-----BEGIN CERTIFICATE-----
MIIFSDCCBDCgAwIBAgIGAV7vmlEXMA0GCSqGSIb3DQEBCwUAMIGoMTkwNwYDVQQDDDBDaGFybGVz
IFByb3h5IENBICg1IE9jdCAyMDE3LCBNYWNCb29rLVByby5sb2NhbCkxJTAjBgNVBAsMHGh0dHBz
Oi8vY2hhcmxlc3Byb3h5LmNvbS9zc2wxETAPBgNVBAoMCFhLNzIgTHRkMREwDwYDVQQHDAhBdWNr
bGFuZDERMA8GA1UECAwIQXVja2xhbmQxCzAJBgNVBAYTAk5aMB4XDTAwMDEwMTAwMDAwMFoXDTQ2
MTIwMzAyNTM0MVowgagxOTA3BgNVBAMMMENoYXJsZXMgUHJveHkgQ0EgKDUgT2N0IDIwMTcsIE1h
Y0Jvb2stUHJvLmxvY2FsKTElMCMGA1UECwwcaHR0cHM6Ly9jaGFybGVzcHJveHkuY29tL3NzbDER
MA8GA1UECgwIWEs3MiBMdGQxETAPBgNVBAcMCEF1Y2tsYW5kMREwDwYDVQQIDAhBdWNrbGFuZDEL
MAkGA1UEBhMCTlowggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDiK6natezMyAlgttMV
sPlIVZauzAKpvYCOqbzCGo5WjNzPy9pll2Lct9D8yH+Ji1m7hzBTCsgOTzbI9Fp8yFULLrzGamFH
PLGVx1HjPQJAb0811zA11fdnDBMVFQBOShTkJAadcXv3Q8LcP1Lbxuf0WXgNeApnavcUa3siyb9u
i7VpzdRPsR9Af0Q8n8fnbwd8qkz9gC7scfacKx/JeNsQluyrExbxaFp0UCwW+HCu7ytAuxJvfxYr
zIiyUbjhpUNSy8XYTwToW0KnhRi9m+KDVvagbWHH8/0QYJtdZ4g55Vh8mjOSVRjQilN0I/BpOaQd
Q9ssXUTr5B8568/xhezTAgMBAAGjggF0MIIBcDAPBgNVHRMBAf8EBTADAQH/MIIBLAYJYIZIAYb4
QgENBIIBHROCARlUaGlzIFJvb3QgY2VydGlmaWNhdGUgd2FzIGdlbmVyYXRlZCBieSBDaGFybGVz
IFByb3h5IGZvciBTU0wgUHJveHlpbmcuIElmIHRoaXMgY2VydGlmaWNhdGUgaXMgcGFydCBvZiBh
IGNlcnRpZmljYXRlIGNoYWluLCB0aGlzIG1lYW5zIHRoYXQgeW91J3JlIGJyb3dzaW5nIHRocm91
Z2ggQ2hhcmxlcyBQcm94eSB3aXRoIFNTTCBQcm94eWluZyBlbmFibGVkIGZvciB0aGlzIHdlYnNp
dGUuIFBsZWFzZSBzZWUgaHR0cDovL2NoYXJsZXNwcm94eS5jb20vc3NsIGZvciBtb3JlIGluZm9y
bWF0aW9uLjAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFHJX+Gkr/yvifKoIsTy4mg0Icpt/MA0G
CSqGSIb3DQEBCwUAA4IBAQB90cuWBJ6e3r0PlFmnssnNIOJScoBFetv14wZ8ip+5Tc3/SbIG1kWt
fkDP5q9msB/IGHmaSO98gFwsHmUaubfXOxrG24+n25JHFNX5k/4vZVRBpZQe31lat/gyhM/FQ6FV
22oZi6ixU8rxNQzNl1UVXCz+P8ajz4Q5TH6Vp73JzXOXsa8z/p9Jm4ADoZwyt/XyyIJvsWqy0AWl
S0AT/ertFm52lZcWxG7nLx1aZohs0HhdH/RVjhSWuwWo2iS7m1nwes99RKGIbsMSxnD8+tOptR6Y
Tc1RbZR66V0R/FVJLLzk/IClDXXNgifvJi4FlIv2pE6lGYxvdnHCs3GQC6sA
-----END CERTIFICATE-----
13 changes: 13 additions & 0 deletions app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<debug-overrides>
<trust-anchors>
<certificates src="@raw/charles_ssl_proxying_certificate" />
</trust-anchors>
</debug-overrides>
</network-security-config>

0 comments on commit 1a465e1

Please sign in to comment.