diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 3bf6cb4051bf47c6a60682d059b4c799aeecf266..500df57a777ece5751123a94bb5262012d8d131a 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 8858048e020202378cd629362cff30230e17211f..279400b1cbdff1f78f0a8b3e1984c24596584568 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. *