Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r405 committed - Move test invocation to service.

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r405 committed - Move test invocation to service.


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r405 committed - Move test invocation to service.
  • Date: Tue, 21 Jun 2011 16:14:00 +0000

Revision: 405
Author:

Date: Tue Jun 21 09:12:40 2011
Log: Move test invocation to service.
http://code.google.com/p/ndt/source/detail?r=405

Added:
/branches/android/Android/src/net/measurementlab/ndt/NdtService.java
Modified:
/branches/android/Android/AndroidManifest.xml
/branches/android/Android/src/net/measurementlab/ndt/AndroidNdt2.java
/branches/android/Android/src/net/measurementlab/ndt/Constants.java

=======================================
--- /dev/null
+++ /branches/android/Android/src/net/measurementlab/ndt/NdtService.java Tue Jun 21 09:12:40 2011
@@ -0,0 +1,36 @@
+package net.measurementlab.ndt;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+public class NdtService extends Service {
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Log.i("ndt", "Service created.");
+ }
+
+ @Override
+ public void onStart(Intent intent, int startId) {
+ Log.i("ndt", "Starting NDT service.");
+ super.onStart(intent, startId);
+ try {
+ NdtTests tests = new NdtTests(
+
Constants.SERVER_HOST[Constants.DEFAULT_SERVER],
+ new Android2UiServices(), intent
+
.getStringExtra("networkType"));
+ tests.run();
+ } catch (Throwable tr) {
+ Log.e("ndt", "Problem running tests.", tr);
+ }
+ Log.i("ndt", "Finishing NDT service.");
+ }
+}
=======================================
--- /branches/android/Android/AndroidManifest.xml Mon Jun 20 07:02:17
2011
+++ /branches/android/Android/AndroidManifest.xml Tue Jun 21 09:12:40
2011
@@ -19,6 +19,7 @@
<activity android:name=".SelectServer" android:label="@string/choice_server_title" />
<!-- Statistics.java: Report detailed information to user -->
<activity android:name=".Statistics" android:label="@string/statistics" />
+ <service android:name=".NdtService" />
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/AndroidNdt2.java Mon Jun 20 09:23:24 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/AndroidNdt2.java Tue Jun 21 09:12:40 2011
@@ -38,12 +38,12 @@
@Override
public void onClick(View v) {
try {
- Thread netWorker = new Thread(new
NdtTests(
-
Constants.SERVER_HOST[Constants.DEFAULT_SERVER],
- new
Android2UiServices(), getNetworkType()));
- netWorker.start();
-
- Intent intent = new
Intent(Constants.SERVER_LOCATION);
+ Intent intent = null;
+ intent = new
Intent(getApplicationContext(), NdtService.class);
+ intent.putExtra("networkType",
getNetworkType());
+ startService(intent);
+
+ intent = new
Intent(Constants.SERVER_LOCATION);
startActivity(intent);
} catch (Throwable t) {
Log.e("ndt", "Problem invoking server
location.", t);
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/Constants.java Mon Jun 20 07:02:17 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/Constants.java Tue Jun 21 09:12:40 2011
@@ -29,6 +29,7 @@

// Intents ID
public static final String SERVER_LOCATION = "net.measurementlab.ndt.ServerLocation";
+ public static final String RUN_TESTS =
"net.measurementlab.ndt.RunTests";
public static final String INTENT_SERVER_NO = "serverno";
public static final String INTENT_STATISTICS = "statistics";
public static final String INTENT_LOCATION = "location";


  • [ndt-dev] [ndt] r405 committed - Move test invocation to service., ndt, 06/21/2011

Archive powered by MHonArc 2.6.16.

Top of Page