Skip to content
Snippets Groups Projects
Commit 269f7f35 authored by Peter Joseph De Jonckheere CESM2014's avatar Peter Joseph De Jonckheere CESM2014
Browse files

Ready to get awareness api key

parent 51c9988b
No related branches found
Tags vm-only
No related merge requests found
...@@ -117,32 +117,44 @@ ...@@ -117,32 +117,44 @@
</content> </content>
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <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" 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" name="com.google.android.gms:play-services-places-placereport-15.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.1" level="project" /> <orderEntry type="library" name="android.arch.core:common:1.1.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-fragment-26.1.0" 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="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" 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="com.google.android.gms:play-services-awareness-15.0.1" level="project" />
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" 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:appcompat-v7-26.1.0" level="project" /> <orderEntry type="library" name="com.android.support.constraint:constraint-layout-1.1.2" level="project" />
<orderEntry type="library" name="com.android.support:support-annotations:26.1.0@jar" level="project" /> <orderEntry type="library" name="com.jjoe64:graphview-4.2.2" level="project" />
<orderEntry type="library" name="com.android.support.constraint:constraint-layout-solver:1.0.2@jar" level="project" /> <orderEntry type="library" name="com.google.android.gms:play-services-basement-15.0.1" level="project" />
<orderEntry type="library" name="com.android.support:support-core-utils-26.1.0" 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.constraint:constraint-layout-1.0.2" level="project" /> <orderEntry type="library" name="com.android.support:support-vector-drawable-27.1.1" 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" scope="TEST" name="com.google.code.findbugs:jsr305:2.0.1@jar" 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" 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="com.google.android.gms:play-services-tasks-15.0.1" level="project" />
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" 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" 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" 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" 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> </component>
</module> </module>
\ No newline at end of file
...@@ -4,7 +4,7 @@ android { ...@@ -4,7 +4,7 @@ android {
compileSdkVersion 27 compileSdkVersion 27
defaultConfig { defaultConfig {
applicationId "com.example.pharmacy.myapplication" applicationId "com.example.pharmacy.myapplication"
minSdkVersion 21 minSdkVersion 19
targetSdkVersion 27 targetSdkVersion 27
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
...@@ -21,9 +21,11 @@ android { ...@@ -21,9 +21,11 @@ android {
} }
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2' 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' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
} }
package com.notificationFramework.stimulusStrategy; package com.notificationFramework.stimulusStrategy;
import android.app.Service; import android.app.Service;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.hardware.Sensor; import android.hardware.Sensor;
import android.hardware.SensorEvent; import android.hardware.SensorEvent;
import android.hardware.SensorEventListener; import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
...@@ -13,15 +15,43 @@ import android.support.annotation.Nullable; ...@@ -13,15 +15,43 @@ import android.support.annotation.Nullable;
*/ */
public class ProximitySensor extends Service implements SensorEventListener { 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 @Nullable
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
return null; return null;
} }
/**
* Changes the field values when a the proximity sensor reports a change.
*
* @param event the sensor event which occurred
*/
@Override @Override
public void onSensorChanged(SensorEvent sensorEvent) { public void onSensorChanged(SensorEvent event) {
proximity = event.values[0];
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment