File tree Expand file tree Collapse file tree 4 files changed +49
-5
lines changed
src/main/java/es/uji/geotec/wearossensors Expand file tree Collapse file tree 4 files changed +49
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ To install the library you have to add the dependency in your `build.gradle`:
2828
2929``` groovy
3030dependencies {
31- implementation 'io.github.geotecinit:wear-os-sensors:1.0 .0'
31+ implementation 'io.github.geotecinit:wear-os-sensors:1.1 .0'
3232}
3333```
3434
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ android {
3131 withJavadocJar()
3232 withSourcesJar()
3333 }
34+
35+ singleVariant(' debug' ) {
36+ withSourcesJar()
37+ }
3438 }
3539}
3640
@@ -39,7 +43,7 @@ publishing {
3943 release(MavenPublication ) {
4044 groupId = ' io.github.geotecinit'
4145 artifactId = ' wear-os-sensors'
42- version = ' 1.0 .0'
46+ version = ' 1.1 .0'
4347
4448 afterEvaluate {
4549 from components. release
@@ -74,6 +78,16 @@ publishing {
7478 }
7579 }
7680 }
81+
82+ debug(MavenPublication ) {
83+ groupId = ' io.github.geotecinit'
84+ artifactId = ' wear-os-sensors'
85+ version = ' 1.1.0-debug'
86+
87+ afterEvaluate {
88+ from components. debug
89+ }
90+ }
7791 }
7892
7993 repositories {
@@ -96,7 +110,7 @@ dependencies {
96110 implementation ' com.google.android.gms:play-services-wearable:17.1.0'
97111 implementation ' com.google.code.gson:gson:2.9.0'
98112 implementation ' com.google.android.gms:play-services-location:20.0.0'
99- api ' io.github.geotecinit:background-sensors:1.0 .0'
113+ api ' io.github.geotecinit:background-sensors:1.1 .0'
100114 testImplementation ' junit:junit:4.13.2'
101115 androidTestImplementation ' androidx.test.ext:junit:1.1.3'
102116 androidTestImplementation ' androidx.test.espresso:espresso-core:3.4.0'
Original file line number Diff line number Diff line change 1616import es .uji .geotec .wearossensors .permissions .PermissionsManager ;
1717import es .uji .geotec .wearossensors .records .callbacks .RecordCallbackProvider ;
1818import es .uji .geotec .wearossensors .sensor .WearSensor ;
19- import es .uji .geotec .wearossensors .services .WearSensorRecordingService ;
19+ import es .uji .geotec .wearossensors .services .RecordingServiceManager ;
2020
2121public abstract class AbstractMessagingHandler {
2222
@@ -25,7 +25,7 @@ public abstract class AbstractMessagingHandler {
2525
2626 public AbstractMessagingHandler (Context context ) {
2727 this .context = context ;
28- this .serviceManager = new ServiceManager (context , WearSensorRecordingService . class );
28+ this .serviceManager = new ServiceManager (context , RecordingServiceManager . getService ( context ) );
2929 }
3030
3131 public void handleMessage (MessageEvent event ) {
Original file line number Diff line number Diff line change 1+ package es .uji .geotec .wearossensors .services ;
2+
3+ import android .content .Context ;
4+ import android .content .SharedPreferences ;
5+
6+ public class RecordingServiceManager {
7+
8+ private static final String PREFERENCES_NAME = "WEAROSSENSORS_PREFS" ;
9+ private static final String RECORDING_SERVICE_KEY = "RECORDING_SERVICE" ;
10+
11+ public static void setService (Context context , Class <?> permissionsActivity ) {
12+ SharedPreferences preferences = context .getSharedPreferences (PREFERENCES_NAME , Context .MODE_PRIVATE );
13+ SharedPreferences .Editor editor = preferences .edit ();
14+ editor .putString (RECORDING_SERVICE_KEY , permissionsActivity .getName ());
15+ editor .apply ();
16+ }
17+
18+ public static Class <?> getService (Context context ) {
19+ SharedPreferences preferences = context .getSharedPreferences (PREFERENCES_NAME , Context .MODE_PRIVATE );
20+ String className = preferences .getString (RECORDING_SERVICE_KEY , WearSensorRecordingService .class .getName ());
21+
22+ Class <?> permissionsActivityClass = null ;
23+ try {
24+ permissionsActivityClass = Class .forName (className );
25+ } catch (ClassNotFoundException e ) {
26+ e .printStackTrace ();
27+ }
28+ return permissionsActivityClass ;
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments