Spring Boot SSL with Android Retrofit

To setup Spring Boot SSL with Android Retrofit connecting on HTTPS 443: In Spring Boot <your project>/src/main/resources/application.properties – add the following values (not the “1.” which is just WordPress ordered list numbering) security.require-ssl=true server.port=8443 server.ssl.key-store=src/main/resources/private/keystore server.ssl.key-store-password=changeit server.ssl.key-password=changeit create and add an SSL key to the location specified by server.ssl.key-store. Note: the SSL certificate file is… Read More »

Android Studio Permanently Change Debug Configuration for Working Directory $MODULE_DIR$ and app:assembleDebugUnitTest

On Mac OS X, Android Studio’s default debug Unit Test build configuration generally doesn’t run with default settings complaining that: AndroidManifest.xml not found or not a file; it should point to your project’s AndroidManifest.xml To fix this error you need to edit your debug configuration to set Working Directory as $MODULE_DIR$ and it makes builds… Read More »

Android AsyncTask return result

To get Android AsyncTask to return a result use a callback method (Observer pattern) by following these steps. Define a constructor for our async class which extends AsyncTask (we’re required to subclass/extend AsyncTask for use). Let’s call our AsyncTask class MyAsyncTask. Constructor parameter takes a class which will handle the AsyncTask result.  Usually an Activity or Fragment,… Read More »

H2 Web Console to In Memory Database – Spring Boot

To get an H2 Database Web Console accessing an in-memory database running on Spring Boot: Register H2’s WebServlet (with UrlMapping /console/*) to your Spring project in a Configuration annotated class. Restart your Application. Open a web page to http://localhost:8080/console/ Be sure you’re accessing the correct database JDBC URL (default would be jdbc:h2:mem:testdb) (Credit: Spring Framework Guru)   import org.h2.server.web.WebServlet;… Read More »

Robolectric reference

Robolectric Android testing Fragments and more private ReminderManagerFragment startReminderManagerFragment() { final ReminderManagerFragment fragment = new ReminderManagerFragment(); SupportFragmentTestUtil.startVisibleFragment(fragment); return fragment; } @Test public void reminderManagerTest() throws Exception { // by default there should be 3 Reminder rows ReminderManagerFragment fragment = startReminderManagerFragment(); assertThat(fragment).isNotNull(); Button addButton = (Button) fragment.getView().findViewById(R.id.reminder_add_button); assertThat(addButton).isNotNull(); List<Reminder> reminders = getReminders(TestValues.BillyUser); assertThat(reminders.size()).isEqualTo(3); // add a… Read More »

PendingIntent requestCode getBroadcast useless doesn’t work

Android PendingIntent requestcode on getBroadcast() method is useless.  It won’t be used at all for making a unique PendingIntent. Use other fields such as Data (Intent.setData(“someStringPerhapsInteger.valueOf(RequestCode)”)) to make your PendingIntent unique for use with AlarmManager for Notifications for example. http://stackoverflow.com/a/33203752/2301224

Most efficient Mac browser Safari

Safari is the most efficient Mac browser using the least amount of battery power (amperage) compared to Firefox and Chrome on Apple MacBooks.  In a quick test of watching YouTube videos in browsers here’s how much battery/energy each browser used: Safari: 1250 mA Firefox: 1600mA Chrome: 3600mA Chrome is far and away the most power hungry… Read More »

Robotium reference

Enter text EditText / text field solo.enterText((EditText) solo.getView(R.id.email_edittext), “baduser@gmail.com”); Click Button solo.clickOnButton(“Login”); Check for Toast Text Message assertTrue(solo.waitForText(getActivity().getResources() .getString(R.string.msg_login_failed)));     More to come…