Tidying up log messages - in particular using Log.i for more important ones, and keeping Log.v for regular messages.
This commit is contained in:
@@ -134,7 +134,8 @@ public class OsdUtil {
|
|||||||
|
|
||||||
|
|
||||||
public boolean isServerRunning() {
|
public boolean isServerRunning() {
|
||||||
//Log.v(TAG,"isServerRunning()................");
|
int nServers = 0;
|
||||||
|
/* Log.v(TAG,"isServerRunning()...."); */
|
||||||
ActivityManager manager =
|
ActivityManager manager =
|
||||||
(ActivityManager) mContext.getSystemService(mContext.ACTIVITY_SERVICE);
|
(ActivityManager) mContext.getSystemService(mContext.ACTIVITY_SERVICE);
|
||||||
for (ActivityManager.RunningServiceInfo service :
|
for (ActivityManager.RunningServiceInfo service :
|
||||||
@@ -142,12 +143,15 @@ public class OsdUtil {
|
|||||||
//Log.v(TAG,"Service: "+service.service.getClassName());
|
//Log.v(TAG,"Service: "+service.service.getClassName());
|
||||||
if ("uk.org.openseizuredetector.SdServer"
|
if ("uk.org.openseizuredetector.SdServer"
|
||||||
.equals(service.service.getClassName())) {
|
.equals(service.service.getClassName())) {
|
||||||
//Log.v(TAG,"Yes!");
|
nServers = nServers + 1;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Log.v(TAG,"No!");
|
if (nServers != 0) {
|
||||||
return false;
|
Log.v(TAG, "isServerRunning() - " + nServers + " instances are running");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,7 +159,7 @@ public class OsdUtil {
|
|||||||
*/
|
*/
|
||||||
public void startServer() {
|
public void startServer() {
|
||||||
// Start the server
|
// Start the server
|
||||||
Log.v(TAG,"startServer()");
|
Log.i(TAG,"OsdUtil.startServer()");
|
||||||
writeToSysLogFile("startServer() - starting server");
|
writeToSysLogFile("startServer() - starting server");
|
||||||
Intent sdServerIntent;
|
Intent sdServerIntent;
|
||||||
sdServerIntent = new Intent(mContext, SdServer.class);
|
sdServerIntent = new Intent(mContext, SdServer.class);
|
||||||
@@ -167,7 +171,7 @@ public class OsdUtil {
|
|||||||
* Stop the SdServer service
|
* Stop the SdServer service
|
||||||
*/
|
*/
|
||||||
public void stopServer() {
|
public void stopServer() {
|
||||||
Log.v(TAG, "stopping Server...");
|
Log.i(TAG, "OsdUtil.stopServer() - stopping Server...");
|
||||||
writeToSysLogFile("stopserver() - stopping server");
|
writeToSysLogFile("stopserver() - stopping server");
|
||||||
|
|
||||||
// then send an Intent to stop the service.
|
// then send an Intent to stop the service.
|
||||||
@@ -182,7 +186,7 @@ public class OsdUtil {
|
|||||||
* bind an activity to to an already running server.
|
* bind an activity to to an already running server.
|
||||||
*/
|
*/
|
||||||
public void bindToServer(Activity activity, SdServiceConnection sdServiceConnection) {
|
public void bindToServer(Activity activity, SdServiceConnection sdServiceConnection) {
|
||||||
Log.v(TAG, "bindToServer() - binding to SdServer");
|
Log.i(TAG, "OsdUtil.bindToServer() - binding to SdServer");
|
||||||
writeToSysLogFile("bindToServer() - binding to SdServer");
|
writeToSysLogFile("bindToServer() - binding to SdServer");
|
||||||
Intent intent = new Intent(sdServiceConnection.mContext, SdServer.class);
|
Intent intent = new Intent(sdServiceConnection.mContext, SdServer.class);
|
||||||
activity.bindService(intent, sdServiceConnection, Context.BIND_AUTO_CREATE);
|
activity.bindService(intent, sdServiceConnection, Context.BIND_AUTO_CREATE);
|
||||||
@@ -194,7 +198,7 @@ public class OsdUtil {
|
|||||||
public void unbindFromServer(Activity activity, SdServiceConnection sdServiceConnection) {
|
public void unbindFromServer(Activity activity, SdServiceConnection sdServiceConnection) {
|
||||||
// unbind this activity from the service if it is bound.
|
// unbind this activity from the service if it is bound.
|
||||||
if (sdServiceConnection.mBound) {
|
if (sdServiceConnection.mBound) {
|
||||||
Log.v(TAG, "unbindFromServer() - unbinding");
|
Log.i(TAG, "unbindFromServer() - unbinding");
|
||||||
writeToSysLogFile("unbindFromServer() - unbinding");
|
writeToSysLogFile("unbindFromServer() - unbinding");
|
||||||
try {
|
try {
|
||||||
activity.unbindService(sdServiceConnection);
|
activity.unbindService(sdServiceConnection);
|
||||||
@@ -204,7 +208,7 @@ public class OsdUtil {
|
|||||||
writeToSysLogFile("unbindFromServer() - error unbinding service - " +ex.toString());
|
writeToSysLogFile("unbindFromServer() - error unbinding service - " +ex.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "unbindFromServer() - not bound to server - ignoring");
|
Log.i(TAG, "unbindFromServer() - not bound to server - ignoring");
|
||||||
writeToSysLogFile("unbindFromServer() - not bound to server - ignoring");
|
writeToSysLogFile("unbindFromServer() - not bound to server - ignoring");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
|
|
||||||
// Show the main activity on the user's screen.
|
// Show the main activity on the user's screen.
|
||||||
private void showMainActivity() {
|
private void showMainActivity() {
|
||||||
Log.v(TAG, "showMainActivity()");
|
Log.i(TAG, "showMainActivity()");
|
||||||
mUtil.writeToSysLogFile("SdServer.showMainActivity()");
|
mUtil.writeToSysLogFile("SdServer.showMainActivity()");
|
||||||
|
|
||||||
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
|
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
|
||||||
@@ -398,10 +398,10 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
ComponentName componentInfo = runningTaskInfo.get(0).topActivity;
|
ComponentName componentInfo = runningTaskInfo.get(0).topActivity;
|
||||||
|
|
||||||
if (componentInfo.getPackageName().equals("uk.org.openseizuredetector")) {
|
if (componentInfo.getPackageName().equals("uk.org.openseizuredetector")) {
|
||||||
Log.v(TAG, "showMainActivity(): OpenSeizureDetector Activity is already shown on top - not doing anything");
|
Log.i(TAG, "showMainActivity(): OpenSeizureDetector Activity is already shown on top - not doing anything");
|
||||||
mUtil.writeToSysLogFile("SdServer.showMainActivity - Activity is already shown on top, not doing anything");
|
mUtil.writeToSysLogFile("SdServer.showMainActivity - Activity is already shown on top, not doing anything");
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "showMainActivity(): Showing Main Activity");
|
Log.i(TAG, "showMainActivity(): Showing Main Activity");
|
||||||
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
this.startActivity(i);
|
this.startActivity(i);
|
||||||
@@ -526,7 +526,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
|
|
||||||
// Called by SdDataSource when a fault condition is detected.
|
// Called by SdDataSource when a fault condition is detected.
|
||||||
public void onSdDataFault(SdData sdData) {
|
public void onSdDataFault(SdData sdData) {
|
||||||
Log.v(TAG, "onSdDataFault()");
|
Log.i(TAG, "onSdDataFault()");
|
||||||
mSdData = sdData;
|
mSdData = sdData;
|
||||||
mSdData.alarmState = 4; // set fault alarm state.
|
mSdData.alarmState = 4; // set fault alarm state.
|
||||||
mSdData.alarmStanding = false;
|
mSdData.alarmStanding = false;
|
||||||
@@ -665,16 +665,16 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
+ loc.getLongitude() + ","
|
+ loc.getLongitude() + ","
|
||||||
+ loc.getLatitude());
|
+ loc.getLatitude());
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "sendSMSAlarm() - Last Location is Null so sending first SMS without location.");
|
Log.i(TAG, "sendSMSAlarm() - Last Location is Null so sending first SMS without location.");
|
||||||
}
|
}
|
||||||
Log.v(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers.length + " Numbers");
|
Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers.length + " Numbers");
|
||||||
mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()");
|
mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()");
|
||||||
Time tnow = new Time(Time.getCurrentTimezone());
|
Time tnow = new Time(Time.getCurrentTimezone());
|
||||||
tnow.setToNow();
|
tnow.setToNow();
|
||||||
String dateStr = tnow.format("%H:%M:%S %d/%m/%Y");
|
String dateStr = tnow.format("%H:%M:%S %d/%m/%Y");
|
||||||
// SmsManager sm = SmsManager.getDefault();
|
// SmsManager sm = SmsManager.getDefault();
|
||||||
for (int i = 0; i < mSMSNumbers.length; i++) {
|
for (int i = 0; i < mSMSNumbers.length; i++) {
|
||||||
Log.v(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]);
|
Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]);
|
||||||
// sm.sendTextMessage(mSMSNumbers[i], null, mSMSMsgStr + " - " + dateStr, null, null);
|
// sm.sendTextMessage(mSMSNumbers[i], null, mSMSMsgStr + " - " + dateStr, null, null);
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
intent.setDataAndType(Uri.parse("smsto:"), "vnd.android-dir/mms-sms");
|
intent.setDataAndType(Uri.parse("smsto:"), "vnd.android-dir/mms-sms");
|
||||||
@@ -683,11 +683,11 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "sendSMSAlarm() - Failed to send SMS.");
|
Log.e(TAG, "sendSMSAlarm() - Failed to send SMS.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
||||||
Toast toast = Toast.makeText(getApplicationContext(),
|
Toast toast = Toast.makeText(getApplicationContext(),
|
||||||
"SMS Alarms Disabled - not doing anything!",
|
"SMS Alarms Disabled - not doing anything!",
|
||||||
Toast.LENGTH_SHORT);
|
Toast.LENGTH_SHORT);
|
||||||
@@ -705,12 +705,12 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
public void onSdLocationReceived(Location ll) {
|
public void onSdLocationReceived(Location ll) {
|
||||||
if (ll == null) {
|
if (ll == null) {
|
||||||
mUtil.showToast("onSdLocationReceived() - NULL LOCATION RECEIVED");
|
mUtil.showToast("onSdLocationReceived() - NULL LOCATION RECEIVED");
|
||||||
Log.v(TAG, "onSdLocationReceived() - NULL LOCATION RECEIVED");
|
Log.w(TAG, "onSdLocationReceived() - NULL LOCATION RECEIVED");
|
||||||
} else {
|
} else {
|
||||||
//mUtil.showToast("onSdLocationReceived() - found location" + ll.toString());
|
//mUtil.showToast("onSdLocationReceived() - found location" + ll.toString());
|
||||||
Log.v(TAG, "onSdLocationReceived() - found location" + ll.toString());
|
Log.i(TAG, "onSdLocationReceived() - found location" + ll.toString());
|
||||||
if (mSMSAlarm) {
|
if (mSMSAlarm) {
|
||||||
Log.v(TAG, "onSdLocationReceived() - Sending to " + mSMSNumbers.length + " Numbers");
|
Log.i(TAG, "onSdLocationReceived() - Sending to " + mSMSNumbers.length + " Numbers");
|
||||||
mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()");
|
mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()");
|
||||||
Time tnow = new Time(Time.getCurrentTimezone());
|
Time tnow = new Time(Time.getCurrentTimezone());
|
||||||
tnow.setToNow();
|
tnow.setToNow();
|
||||||
@@ -726,17 +726,17 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
+ ll.getLatitude() + "%2C" + ll.getLongitude();
|
+ ll.getLatitude() + "%2C" + ll.getLongitude();
|
||||||
String messageStr = mSMSMsgStr + " - " +
|
String messageStr = mSMSMsgStr + " - " +
|
||||||
dateStr + " - " + googleUrl;
|
dateStr + " - " + googleUrl;
|
||||||
Log.v(TAG, "onSdLocationReceived() - Message is " + messageStr);
|
Log.i(TAG, "onSdLocationReceived() - Message is " + messageStr);
|
||||||
mUtil.showToast(messageStr);
|
mUtil.showToast(messageStr);
|
||||||
SmsManager sm = SmsManager.getDefault();
|
SmsManager sm = SmsManager.getDefault();
|
||||||
for (int i = 0; i < mSMSNumbers.length; i++) {
|
for (int i = 0; i < mSMSNumbers.length; i++) {
|
||||||
Log.v(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]);
|
Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]);
|
||||||
sm.sendTextMessage(mSMSNumbers[i], null,
|
sm.sendTextMessage(mSMSNumbers[i], null,
|
||||||
messageStr,
|
messageStr,
|
||||||
null, null);
|
null, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
||||||
Toast toast = Toast.makeText(getApplicationContext(),
|
Toast toast = Toast.makeText(getApplicationContext(),
|
||||||
"SMS Alarms Disabled - not doing anything!",
|
"SMS Alarms Disabled - not doing anything!",
|
||||||
Toast.LENGTH_SHORT);
|
Toast.LENGTH_SHORT);
|
||||||
@@ -782,7 +782,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
* set the alarm standing flags to false to allow alarm phase to reset to current value.
|
* set the alarm standing flags to false to allow alarm phase to reset to current value.
|
||||||
*/
|
*/
|
||||||
public void acceptAlarm() {
|
public void acceptAlarm() {
|
||||||
Log.v(TAG, "acceptAlarm()");
|
Log.i(TAG, "acceptAlarm()");
|
||||||
mSdData.alarmStanding = false;
|
mSdData.alarmStanding = false;
|
||||||
mSdData.fallAlarmStanding = false;
|
mSdData.fallAlarmStanding = false;
|
||||||
mSdDataSource.acceptAlarm();
|
mSdDataSource.acceptAlarm();
|
||||||
@@ -794,12 +794,12 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
// Start timer to remove the cancel audible flag
|
// Start timer to remove the cancel audible flag
|
||||||
// after the required period.
|
// after the required period.
|
||||||
if (mCancelAudibleTimer != null) {
|
if (mCancelAudibleTimer != null) {
|
||||||
Log.v(TAG, "cancelAudible(): cancel audible timer already running - cancelling it.");
|
Log.i(TAG, "cancelAudible(): cancel audible timer already running - cancelling it.");
|
||||||
mCancelAudibleTimer.cancel();
|
mCancelAudibleTimer.cancel();
|
||||||
mCancelAudibleTimer = null;
|
mCancelAudibleTimer = null;
|
||||||
mCancelAudible = false;
|
mCancelAudible = false;
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "cancelAudible(): starting cancel audible timer");
|
Log.i(TAG, "cancelAudible(): starting cancel audible timer");
|
||||||
mCancelAudible = true;
|
mCancelAudible = true;
|
||||||
mCancelAudibleTimer =
|
mCancelAudibleTimer =
|
||||||
// conver to ms.
|
// conver to ms.
|
||||||
@@ -826,18 +826,18 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
* problems.
|
* problems.
|
||||||
*/
|
*/
|
||||||
protected void startWebServer() {
|
protected void startWebServer() {
|
||||||
Log.v(TAG, "startWebServer()");
|
Log.i(TAG, "startWebServer()");
|
||||||
mUtil.writeToSysLogFile("SdServer.Start Web Server.");
|
mUtil.writeToSysLogFile("SdServer.Start Web Server.");
|
||||||
if (webServer == null) {
|
if (webServer == null) {
|
||||||
webServer = new SdWebServer(getApplicationContext(), mUtil.getDataStorageDir(), mSdData, this);
|
webServer = new SdWebServer(getApplicationContext(), mUtil.getDataStorageDir(), mSdData, this);
|
||||||
try {
|
try {
|
||||||
webServer.start();
|
webServer.start();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.w(TAG, "startWebServer(): Error: " + ioe.toString());
|
Log.e(TAG, "startWebServer(): Error: " + ioe.toString());
|
||||||
}
|
}
|
||||||
Log.w(TAG, "startWebServer(): Web server initialized.");
|
Log.i(TAG, "startWebServer(): Web server initialized.");
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "startWebServer(): server already running???");
|
Log.i(TAG, "startWebServer(): server already running???");
|
||||||
}
|
}
|
||||||
|
|
||||||
mNetworkBroadcastReceiver = new NetworkBroadcastReceiver();
|
mNetworkBroadcastReceiver = new NetworkBroadcastReceiver();
|
||||||
@@ -851,11 +851,11 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
* And de-register for network connectivity events.
|
* And de-register for network connectivity events.
|
||||||
*/
|
*/
|
||||||
protected void stopWebServer() {
|
protected void stopWebServer() {
|
||||||
Log.v(TAG, "SdServer.stopWebServer()");
|
Log.i(TAG, "SdServer.stopWebServer()");
|
||||||
if (webServer != null) {
|
if (webServer != null) {
|
||||||
webServer.stop();
|
webServer.stop();
|
||||||
if (webServer.isAlive()) {
|
if (webServer.isAlive()) {
|
||||||
Log.v(TAG, "stopWebServer() - server still alive???");
|
Log.w(TAG, "stopWebServer() - server still alive???");
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "stopWebServer() - server died ok");
|
Log.v(TAG, "stopWebServer() - server died ok");
|
||||||
}
|
}
|
||||||
@@ -878,9 +878,9 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
try {
|
try {
|
||||||
activeNetwork = cm.getActiveNetworkInfo();
|
activeNetwork = cm.getActiveNetworkInfo();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "NetworkBroadcastReceiver - failed to retrieve active network info");
|
Log.e(TAG, "NetworkBroadcastReceiver - failed to retrieve active network info");
|
||||||
mUtil.writeToSysLogFile("NetworkBroadcastReceiver - failed to retrieve active network info");
|
mUtil.writeToSysLogFile("NetworkBroadcastReceiver - failed to retrieve active network info");
|
||||||
Log.v(TAG, e.toString());
|
Log.e(TAG, e.toString());
|
||||||
}
|
}
|
||||||
boolean isConnected = activeNetwork != null &&
|
boolean isConnected = activeNetwork != null &&
|
||||||
activeNetwork.isConnectedOrConnecting();
|
activeNetwork.isConnectedOrConnecting();
|
||||||
@@ -920,7 +920,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
|||||||
* - defined in res/xml/prefs.xml
|
* - defined in res/xml/prefs.xml
|
||||||
*/
|
*/
|
||||||
public void updatePrefs() {
|
public void updatePrefs() {
|
||||||
Log.v(TAG, "updatePrefs()");
|
Log.i(TAG, "updatePrefs()");
|
||||||
mUtil.writeToSysLogFile("SdServer.updatePrefs()");
|
mUtil.writeToSysLogFile("SdServer.updatePrefs()");
|
||||||
|
|
||||||
SharedPreferences SP = PreferenceManager
|
SharedPreferences SP = PreferenceManager
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public class StartupActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Log.i(TAG,"onCreate()");
|
||||||
|
|
||||||
// Set our custom uncaught exception handler to report issues.
|
// Set our custom uncaught exception handler to report issues.
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new OsdUncaughtExceptionHandler(StartupActivity.this));
|
Thread.setDefaultUncaughtExceptionHandler(new OsdUncaughtExceptionHandler(StartupActivity.this));
|
||||||
@@ -168,6 +169,7 @@ public class StartupActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
Log.i(TAG,"onStart()");
|
||||||
mUtil.writeToSysLogFile("StartupActivity.onStart()");
|
mUtil.writeToSysLogFile("StartupActivity.onStart()");
|
||||||
TextView tv;
|
TextView tv;
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ public class StartupActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
Log.v(TAG, "onStop()");
|
Log.i(TAG, "onStop()");
|
||||||
mUtil.writeToSysLogFile("StartupActivity.onStop() - unbinding from server");
|
mUtil.writeToSysLogFile("StartupActivity.onStop() - unbinding from server");
|
||||||
mUtil.unbindFromServer(this, mConnection);
|
mUtil.unbindFromServer(this, mConnection);
|
||||||
mUiTimer.cancel();
|
mUiTimer.cancel();
|
||||||
@@ -246,6 +248,8 @@ public class StartupActivity extends Activity {
|
|||||||
TextView tv;
|
TextView tv;
|
||||||
ProgressBar pb;
|
ProgressBar pb;
|
||||||
|
|
||||||
|
Log.v(TAG,"serverStatusRunnable()");
|
||||||
|
|
||||||
// Service Running
|
// Service Running
|
||||||
tv = (TextView) findViewById(R.id.textItem1);
|
tv = (TextView) findViewById(R.id.textItem1);
|
||||||
pb = (ProgressBar) findViewById(R.id.progressBar1);
|
pb = (ProgressBar) findViewById(R.id.progressBar1);
|
||||||
@@ -390,7 +394,7 @@ public class StartupActivity extends Activity {
|
|||||||
if (allOk) {
|
if (allOk) {
|
||||||
if (!mDialogDisplayed) {
|
if (!mDialogDisplayed) {
|
||||||
if (!mStartedMainActivity) {
|
if (!mStartedMainActivity) {
|
||||||
Log.v(TAG, "starting main activity...");
|
Log.i(TAG, "serverStatusRunnable() - starting main activity...");
|
||||||
mUtil.writeToSysLogFile("StartupActivity.serverStatusRunnable - all checks ok - starting main activity.");
|
mUtil.writeToSysLogFile("StartupActivity.serverStatusRunnable - all checks ok - starting main activity.");
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
@@ -402,7 +406,7 @@ public class StartupActivity extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
mStartedMainActivity = false;
|
mStartedMainActivity = false;
|
||||||
Log.v(TAG, "exception starting main activity " + ex.toString());
|
Log.e(TAG, "exception starting main activity " + ex.toString());
|
||||||
mUtil.writeToSysLogFile("StartupActivity.serverStatusRunnable - exception starting main activity " + ex.toString());
|
mUtil.writeToSysLogFile("StartupActivity.serverStatusRunnable - exception starting main activity " + ex.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -445,6 +449,7 @@ public class StartupActivity extends Activity {
|
|||||||
AlertDialog UpdateDialog;
|
AlertDialog UpdateDialog;
|
||||||
AlertDialog FirstRunDialog;
|
AlertDialog FirstRunDialog;
|
||||||
SharedPreferences prefs;
|
SharedPreferences prefs;
|
||||||
|
Log.i(TAG,"checkFirstRun()");
|
||||||
versionName = this.getVersionName(this, StartupActivity.class);
|
versionName = this.getVersionName(this, StartupActivity.class);
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
storedVersionName = (prefs.getString("AppVersionName", null));
|
storedVersionName = (prefs.getString("AppVersionName", null));
|
||||||
@@ -481,7 +486,7 @@ public class StartupActivity extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
FirstRunDialog = alertDialogBuilder.create();
|
FirstRunDialog = alertDialogBuilder.create();
|
||||||
Log.v(TAG, "Displaying First Run Dialog");
|
Log.i(TAG, "Displaying First Run Dialog");
|
||||||
FirstRunDialog.show();
|
FirstRunDialog.show();
|
||||||
mDialogDisplayed = true;
|
mDialogDisplayed = true;
|
||||||
} else if (!storedVersionName.equals(versionName)) {
|
} else if (!storedVersionName.equals(versionName)) {
|
||||||
@@ -512,13 +517,13 @@ public class StartupActivity extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
UpdateDialog = alertDialogBuilder.create();
|
UpdateDialog = alertDialogBuilder.create();
|
||||||
Log.v(TAG, "Displaying Update Dialog");
|
Log.i(TAG, "Displaying Update Dialog");
|
||||||
UpdateDialog.show();
|
UpdateDialog.show();
|
||||||
mDialogDisplayed = true;
|
mDialogDisplayed = true;
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "App has already been run - not showing dialog.");
|
Log.v(TAG, "App has already been run - not showing dialog.");
|
||||||
}
|
}
|
||||||
Log.v(TAG, "Setting AppVersionName to" + versionName);
|
Log.i(TAG, "Setting Stored AppVersionName to" + versionName);
|
||||||
prefs.edit().putString("AppVersionName", versionName).commit();
|
prefs.edit().putString("AppVersionName", versionName).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user