Skip to content

Commit

Permalink
* increased version to 1.2.2 (#5)
Browse files Browse the repository at this point in the history
* increased version to 1.2.2
* the default behaviour now is to not force kill a process after it's finished
* removed the onQuit() method from the SnapServices as it serves no purpose. Moved the logic to onDestroy()
* removed unnecessary dependencies from the snapservices module
  • Loading branch information
mindbirth authored Jul 13, 2017
1 parent d0008e5 commit 9df2dbb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 31 deletions.
6 changes: 4 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.snap.android"
minSdkVersion 16
Expand All @@ -28,12 +28,14 @@ android {
}
}

def supportVersion = "26.0.0-beta2"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.4.0'
compile "com.android.support:appcompat-v7:${supportVersion}"
compile "com.android.support:support-annotations:${supportVersion}"
testCompile 'junit:junit:4.12'
compile project(path: ':snapservices')
}
2 changes: 1 addition & 1 deletion snapservices.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Snap Library Version
version = 1.2.1
version = 1.2.2
3 changes: 1 addition & 2 deletions snapservices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Snap Services Android Library "

android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
buildToolsVersion "26.0.0"

defaultConfig {
minSdkVersion 16
Expand Down Expand Up @@ -34,7 +34,6 @@ android {
def supportVersion = "26.0.0-beta2"
dependencies {
compile "com.android.support:support-annotations:${supportVersion}"
compile "com.android.support:appcompat-v7:${supportVersion}"
}

android.libraryVariants.all { variant ->
Expand Down
6 changes: 1 addition & 5 deletions snapservices/consumer-proguard.pro
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@
}

-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContextWrapper
-keepattributes InnerClasses

-dontwarn android.support.v4.**
-dontwarn android.support.v7.**
-dontwarn android.support.v13.**
-dontwarn android.support.graphics.**

#To completely remove the logging entries and the strings inside it
#-assumenosideeffects class com.android.snap.snapservices.logger.SnapLogger {
# public static void v(...);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,18 @@ private synchronized void stopServiceWorker(ComponentName serviceComponent, int
}

SnapService remove = mServiceWorkers.remove(serviceComponent);

if (remove == null) {
SnapLogger.v("Service [component=" + serviceComponent + ";startId=" + startId + "] killed in the meantime.");
return;
}

try {
remove.onDestroy();
} catch (Exception ex) {
SnapLogger.v("Error destroying service [component=" + serviceComponent + ";startId=" + startId + "]", ex);
}
try {
remove.quit();
} catch (Exception ex) {
SnapLogger.v("Error quitting service [component=" + serviceComponent + ";startId=" + startId + "]", ex);
}

SnapLogger.v("Service [component=" + serviceComponent + ";startId=" + startId + "] stopped!");

if (options.isKillSeparateProcessOnFinish() && verifyIfIsForkedProcess()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,16 @@ protected void stopForeground() {
* <p>Do <b>NOT</b> call this method directly.</p>
*/
public void onDestroy() {

SnapLogger.v("onDestroy called [name=" + mName + "]");
stopForeground();
mServiceLooper.quit();
}

public ISnapBinder onBind(Intent intent) {
SnapLogger.v("onBind called [name=" + mName + "]");
return null;
}

/**
* Called by the system to completely remove the existing thread.
* This is called after {@link #onDestroy()}.
*/
void quit() {
SnapLogger.v("quit called [name=" + mName + "]");
stopForeground();
mServiceLooper.quit();
mThread.quit();
}

/**
* Stop the service if the most recent time it was started was
* <var>startId</var>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private SnapConfigOptions(SnapConfigOptions.Builder builder) {

public static final class Builder {

private boolean killSeparateProcess = true;
private boolean killSeparateProcess = false;
private int logLevel = SnapLogger.DISABLED;

public Builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public ComponentName startForegroundService(Intent service) {
*
* <p><em>NOTE:</em>You should ALWAYS use this method when you want to generate a pending intent for a notification.</p>
* @param intent The intent to be added into a pending intent.
* @param requestCode The private request code of the sender.
* @return The PendingIntent already prepared to be delivered to a SnapService OR, to an Android Service
* if you passed that one instead.
* @see SnapServicesContext#generatePendingIntentForService(Context, Intent, int)
Expand Down
3 changes: 0 additions & 3 deletions snapservices/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit 9df2dbb

Please sign in to comment.