diff --git a/app.iml b/app.iml index c3fd9250626ca6dbece4e9f49cb546332ed7ecd7..ecda003c241a15efa8ca8eb9360fe6a1fa522653 100644 --- a/app.iml +++ b/app.iml @@ -117,32 +117,44 @@ </content> <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="com.android.support:support-media-compat-26.1.0" level="project" /> + <orderEntry type="library" name="com.android.support:animated-vector-drawable-27.1.1" level="project" /> + <orderEntry type="library" name="com.android.support:appcompat-v7-27.1.1" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-base-15.0.1" level="project" /> <orderEntry type="library" scope="TEST" name="junit:junit:4.12@jar" level="project" /> - <orderEntry type="library" name="android.arch.lifecycle:common:1.0.0@jar" level="project" /> - <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.1" level="project" /> - <orderEntry type="library" name="com.android.support:support-fragment-26.1.0" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-places-placereport-15.0.1" level="project" /> + <orderEntry type="library" name="android.arch.core:common:1.1.0@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.2" level="project" /> <orderEntry type="library" scope="TEST" name="javax.inject:javax.inject:1@jar" level="project" /> <orderEntry type="library" scope="TEST" name="com.squareup:javawriter:2.1.1@jar" level="project" /> - <orderEntry type="library" name="com.android.support:support-vector-drawable-26.1.0" level="project" /> - <orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" /> - <orderEntry type="library" name="com.android.support:appcompat-v7-26.1.0" level="project" /> - <orderEntry type="library" name="com.android.support:support-annotations:26.1.0@jar" level="project" /> - <orderEntry type="library" name="com.android.support.constraint:constraint-layout-solver:1.0.2@jar" level="project" /> - <orderEntry type="library" name="com.android.support:support-core-utils-26.1.0" level="project" /> - <orderEntry type="library" name="com.android.support.constraint:constraint-layout-1.0.2" level="project" /> - <orderEntry type="library" name="com.android.support:support-core-ui-26.1.0" level="project" /> - <orderEntry type="library" scope="TEST" name="com.android.support.test:runner-1.0.1" level="project" /> - <orderEntry type="library" scope="TEST" name="com.android.support.test:rules-1.0.1" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-awareness-15.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test:monitor-1.0.2" level="project" /> + <orderEntry type="library" name="com.android.support.constraint:constraint-layout-1.1.2" level="project" /> + <orderEntry type="library" name="com.jjoe64:graphview-4.2.2" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-basement-15.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test:runner-1.0.2" level="project" /> + <orderEntry type="library" name="com.android.support:support-vector-drawable-27.1.1" level="project" /> <orderEntry type="library" scope="TEST" name="com.google.code.findbugs:jsr305:2.0.1@jar" level="project" /> - <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-idling-resource-3.0.1" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:runtime-1.1.0" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:common:1.1.0@jar" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-maps-15.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-idling-resource-3.0.2" level="project" /> <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-core:1.3@jar" level="project" /> - <orderEntry type="library" name="com.android.support:support-compat-26.1.0" level="project" /> - <orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-tasks-15.0.1" level="project" /> + <orderEntry type="library" name="com.android.support:support-core-ui-27.1.1" level="project" /> <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-library:1.3@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-compat-27.1.1" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:viewmodel-1.1.0" level="project" /> <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-integration:1.3@jar" level="project" /> - <orderEntry type="library" name="com.android.support:support-v4-26.1.0" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:livedata-core-1.1.0" level="project" /> <orderEntry type="library" scope="TEST" name="net.sf.kxml:kxml2:2.3.0@jar" level="project" /> - <orderEntry type="library" name="com.android.support:animated-vector-drawable-26.1.0" level="project" /> + <orderEntry type="library" name="com.android.support:support-core-utils-27.1.1" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-location-15.0.1" level="project" /> + <orderEntry type="library" name="com.android.support:support-fragment-27.1.1" level="project" /> + <orderEntry type="library" name="com.google.android.gms:play-services-places-15.0.1" level="project" /> + <orderEntry type="library" name="com.android.support:support-media-compat-27.1.1" level="project" /> + <orderEntry type="library" name="com.android.support:support-annotations:27.1.1@jar" level="project" /> + <orderEntry type="library" name="com.android.support.constraint:constraint-layout-solver:1.1.2@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-v4-27.1.1" level="project" /> + <orderEntry type="library" name="android.arch.core:runtime-1.1.0" level="project" /> </component> </module> \ No newline at end of file diff --git a/build.gradle b/build.gradle index e54cdb401dcc4527fcbc664b37cd74ed09c0bb31..2710eabceba4352c08e3fc482702e668c33ccf6e 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 27 defaultConfig { applicationId "com.example.pharmacy.myapplication" - minSdkVersion 21 + minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" @@ -21,9 +21,11 @@ android { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:26.1.0' - implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'com.jjoe64:graphview:4.2.2' + implementation 'com.google.android.gms:play-services-awareness:15.0.1' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } diff --git a/src/main/java/com/notificationFramework/stimulusStrategy/ProximitySensor.java b/src/main/java/com/notificationFramework/stimulusStrategy/ProximitySensor.java index e706034e72c13495b2cdce536d2a3362ada9e936..d6384b25b6944968e766c7d01f60bf0479fc6b68 100644 --- a/src/main/java/com/notificationFramework/stimulusStrategy/ProximitySensor.java +++ b/src/main/java/com/notificationFramework/stimulusStrategy/ProximitySensor.java @@ -1,10 +1,12 @@ package com.notificationFramework.stimulusStrategy; import android.app.Service; +import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; +import android.hardware.SensorManager; import android.os.IBinder; import android.support.annotation.Nullable; @@ -13,15 +15,43 @@ import android.support.annotation.Nullable; */ public class ProximitySensor extends Service implements SensorEventListener { + + + static float proximity; + + /** + * The method which is called when the ProximitySensor service is started. Sets up the listener to + * be registered which remains constantly registered. + * + * @param intent the intent used to start this service + * @param flags additional information about this service + * @param startId the unique identifier for this service + * @return the conditions under which the OS should treat this service + * @see android.app.Service + */ + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + SensorManager mSensorManager = + (SensorManager) this.getSystemService(Context.SENSOR_SERVICE); + Sensor proximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); + mSensorManager.registerListener(this, proximity, 600000000); + return START_STICKY; + } + @Nullable @Override public IBinder onBind(Intent intent) { return null; } + /** + * Changes the field values when a the proximity sensor reports a change. + * + * @param event the sensor event which occurred + */ @Override - public void onSensorChanged(SensorEvent sensorEvent) { - + public void onSensorChanged(SensorEvent event) { + proximity = event.values[0]; } @Override