diff --git a/.gitignore b/.gitignore index 34918d5..be5c1dd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,12 @@ build *.iml /gradle local.properties +/android/app/src/main/.classpath +/android/app/src/main/.project +/android/app/src/main/.settings +/android/app/src/main/bin +/android/app/src/main/gen +/android/app/src/main/project.properties /android/app/src/main/res/raw/build.txt /artwork /android/captures diff --git a/android/app/build.gradle b/android/app/build.gradle index dd1cb10..756467b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,6 +26,7 @@ android { lintOptions { disable 'MissingTranslation' + abortOnError false } testOptions { @@ -41,7 +42,7 @@ buildscript { } dependencies { // replace with the current version of the Android plugin - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:2.3.0' // the latest version of the android-apt plugin classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e81aed9..2399daf 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -14,6 +14,7 @@ + = VERSION_CODES.JELLY_BEAN) { + Notification.Builder builder = new Notification.Builder(this.getApplicationContext()); + builder.setAutoCancel(false); + builder.setContentTitle(getString(R.string.app_name)); + builder.setContentText(getString(R.string.notification_caption)); + builder.setSmallIcon(R.drawable.icon_greyed_25x25); + builder.setContentIntent(intent); + builder.setOngoing(true); + notification = builder.build(); + } else { + NotificationCompat.Builder compat = new NotificationCompat.Builder(getApplicationContext()); + compat.setAutoCancel(false); + compat.setContentTitle(getString(R.string.app_name)); + compat.setContentText(getString(R.string.notification_caption)); + compat.setSmallIcon(R.drawable.icon_greyed_25x25); + compat.setContentIntent(intent); + compat.setOngoing(true); + notification = compat.build(); + } + + startForeground(NOTIFICATION_ID, notification); } /** @@ -354,7 +385,7 @@ private void stopTracking(int reason) { } } - hideNotification(); + stopForeground(true); } /** @@ -448,42 +479,6 @@ private void updateDatabase() { * Shows Android notification while this service is running. */ private void showNotification() { - PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, TabHostActivity.class), 0); - - // Set the icon, scrolling text and timestamp - //final Notification notification = new Notification(R.drawable.icon_greyed_25x25, getString(R.string.notification_caption), - // System.currentTimeMillis()); - //notification.setLatestEventInfo(this, getString(R.string.app_name), getString(R.string.notification_caption), contentIntent); - - // Set the info for the views that show in the notification panel. - - - if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { - Notification.Builder builder = new Notification.Builder(this.getApplicationContext()); - builder.setAutoCancel(false); - builder.setContentTitle(getString(R.string.app_name)); - builder.setContentText(getString(R.string.notification_caption)); - builder.setSmallIcon(R.drawable.icon_greyed_25x25); - builder.setContentIntent(intent); - builder.setOngoing(true); - mNotificationManager.notify(NOTIFICATION_ID, builder.build()); - } else if (VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN) { - NotificationCompat.Builder compat = new NotificationCompat.Builder(getApplicationContext()); - compat.setAutoCancel(false); - compat.setContentTitle(getString(R.string.app_name)); - compat.setContentText(getString(R.string.notification_caption)); - compat.setSmallIcon(R.drawable.icon_greyed_25x25); - compat.setContentIntent(intent); - compat.setOngoing(true); - mNotificationManager.notify(NOTIFICATION_ID, compat.build()); - } - } - - /** - * Hides Android notification - */ - private void hideNotification() { - mNotificationManager.cancel(NOTIFICATION_ID); } } diff --git a/android/app/src/main/java/org/openbmap/services/wireless/WirelessLoggerService.java b/android/app/src/main/java/org/openbmap/services/wireless/WirelessLoggerService.java index e77b303..511e9ef 100644 --- a/android/app/src/main/java/org/openbmap/services/wireless/WirelessLoggerService.java +++ b/android/app/src/main/java/org/openbmap/services/wireless/WirelessLoggerService.java @@ -355,7 +355,7 @@ public void onSignalStrengthsChanged(final SignalStrength signalStrength) { // TODO we need a timestamp for signal strength try { mCdmaStrengthDbm = signalStrength.getCdmaDbm(); - mCdmaEcIo = signalStrength.getmCdmaEcIo(); + mCdmaEcIo = signalStrength.getCdmaEcio(); } catch (final Exception e) { Log.e(TAG, e.toString(), e); } @@ -368,7 +368,7 @@ public void onSignalStrengthsChanged(final SignalStrength signalStrength) { } try { - mGsmBitErrorRate = signalStrength.getmGsmBitErrorRate(); + mGsmBitErrorRate = signalStrength.getGsmBitErrorRate(); mGsmStrengthAsu = signalStrength.getGsmSignalStrength(); mGsmStrengthDbm = -113 + 2 * mGsmStrengthAsu; // conversion ASU in dBm } catch (final Exception e) { diff --git a/android/gradlew b/android/gradlew old mode 100644 new mode 100755