Skip to content

LoyolaChicagoCode/primenumbers-android-java

Repository files navigation

1# Background

The goal of this example is to demonstrate the tradeoffs found in the mobile + cloud architecture, where one has a choice between doing work locally (on the mobile device) versus remotely (in the cloud) with different performance considerations in each case.

This is a very rough initial attempt and still needs significant work.

Learning Objectives

  • Show how CPU-intensive computation can be off-loaded from a mobile app to the cloud, by comparison to a mobile device, an unlimited resource for computation and storage.
  • synchronous local foreground tasks in Android (running directly in an event listener)
  • asynchronous local background tasks in Android using AsyncTask
  • asynchronous access of remote resources (usually RESTful web services) in Android using AsyncHttpClient

See also the corresponding web service.

Setting up the Environment

Check out the project using Android Studio. This creates the local.properties file with the required line

sdk.dir=<root folder of Android Studio's Android SDK installation>

Running the Application

In Android Studio: Run > Run app

Sample prime numbers to try

The underlying links invoke the corresponding web service on the number.

A Tale of Two AsyncHttpClients

Do not use this AsyncHttpClient in Android. It will throw the infamous android.os.NetworkOnMainThreadException without explicit configuration and has an unnecessary dependency on non-Android logging (slf4j).

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages