From d2d2a10bc073c9f2c615a70abd1e4c857a0660f1 Mon Sep 17 00:00:00 2001 From: Peter De Jonckheere <peter.de-jonckheere.2014@uni.strath.ac.uk> Date: Tue, 3 Jul 2018 13:02:57 +0100 Subject: [PATCH] Need to get debug key. --- src/main/AndroidManifest.xml | 9 +++------ .../stimulusStrategy/SigMotionDetect.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 3bf6cb4..500df57 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -16,11 +16,12 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + <meta-data + android:name="com.google.android.awareness.API_KEY" + android:value="AIzaSyDqliqBcEQQAvMZR-RengdLUJaAYeRKbgs"/> <activity android:name="com.notificationFramework.sedentary.frontEnd.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> @@ -56,9 +57,5 @@ </action> </intent-filter> </receiver> - <meta-data - android:name="com.google.android.awareness.API_KEY" - android:value="AIzaSyDRgsg2n4oPOSRGZ5qYb1QCAeADwoVC0lA"> - </meta-data> </application> </manifest> \ No newline at end of file diff --git a/src/main/java/com/notificationFramework/stimulusStrategy/SigMotionDetect.java b/src/main/java/com/notificationFramework/stimulusStrategy/SigMotionDetect.java index 8858048..279400b 100644 --- a/src/main/java/com/notificationFramework/stimulusStrategy/SigMotionDetect.java +++ b/src/main/java/com/notificationFramework/stimulusStrategy/SigMotionDetect.java @@ -272,8 +272,9 @@ public class SigMotionDetect extends Service implements StimulusStrategy { lbm.sendBroadcast(i); } - private void getExtraData(){ + SharedPreferences preferences = this.getSharedPreferences(getString( + R.string.preference_file_key), Context.MODE_PRIVATE); try { double latitude = Awareness.getSnapshotClient(this).getLocation() .getResult().getLocation().getLatitude(); @@ -283,11 +284,20 @@ public class SigMotionDetect extends Service implements StimulusStrategy { .getPlaces().getResult().getPlaceLikelihoods(); Weather weather = Awareness.getSnapshotClient(this).getWeather().getResult() .getWeather(); + SharedPreferences.Editor editor = preferences.edit(); + editor.putLong(this.getString(R.string.store_lat),Double.doubleToLongBits(latitude)); + editor.putLong(this.getString(R.string.store_long),Double.doubleToLongBits(longitude)); + editor.putString(this.getString(R.string.store_place), String.valueOf(placeLikelihoods.get(0).getPlace().getName())); + editor.putFloat(this.getString(R.string.store_placelike), placeLikelihoods.get(0).getLikelihood()); + editor.putFloat(this.getString(R.string.store_temp),weather.getTemperature(Weather.CELSIUS)); + editor.commit(); + SaveFile.recordData(latitude, longitude, placeLikelihoods, weather, this); }catch(SecurityException e){ Intent i = new Intent(this, RequestPermission.class); startActivity(i); } } + /** * The method which reponds to a bind request for this service. * -- GitLab