Skip to content

Commit

Permalink
AC:534 Integrating android snooper for debugging purpose (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
its-snorlax authored and f4ww4z committed Jun 10, 2019
1 parent c21a940 commit a68157a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ The coding conventions used by OpenMRS are outlined [here](https://wiki.openmrs.
### Model pattern
We are following [Google's MVP sample](https://github.com/googlesamples/android-architecture/tree/todo-mvp) for this application's development.


### HTTP call debugging
In order to debug HTTP calls, we have integrated [Android Snooper](https://github.com/jainsahab/AndroidSnooper) (a GUI based open source library) to track network calls. To use Android snooper, all you have to do is shake your device and snooper will present list of network calls made by OpenMRS app.

# Quick Start

As of February 2016, this project has been migrated to gradle to work successfully with Android Studio.
Expand Down
2 changes: 2 additions & 0 deletions openmrs-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ dependencies {
)

androidTestImplementation files('libs/the-missing-android-xml-junit-test-runner-release-1.3_2.jar')
debugImplementation 'com.github.jainsahab:Snooper-Okhttp:1.5.4'
releaseImplementation 'com.github.jainsahab:Snooper-Okhttp-No-Op:1.5.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.guava:guava:23.0'
implementation "androidx.appcompat:appcompat:$support_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.prateekj.snooper.okhttp.SnooperInterceptor;

import org.openmrs.mobile.application.OpenMRS;
import org.openmrs.mobile.models.Observation;
Expand Down Expand Up @@ -69,6 +70,7 @@ public static <S> S createService(Class<S> serviceClass, String username, String
});
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
httpClient.addInterceptor(new SnooperInterceptor());
httpClient.addInterceptor(logging);
}
OkHttpClient client = httpClient.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.activeandroid.ActiveAndroid;
import com.activeandroid.Configuration;
import com.prateekj.snooper.AndroidSnooper;

import net.sqlcipher.database.SQLiteDatabase;

Expand Down Expand Up @@ -61,7 +62,7 @@ public void onCreate() {
mLogger = new OpenMRSLogger();
OpenMRSDBOpenHelper.init();
initializeDB();

AndroidSnooper.init(this);
Intent i = new Intent(this, FormListService.class);
startService(i);
Intent intent = new Intent(this, AuthenticateCheckService.class);
Expand Down

0 comments on commit a68157a

Please sign in to comment.