Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SedentaryBehaviourApplication
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Joseph De Jonckheere CESM2014
SedentaryBehaviourApplication
Commits
31dbb4e1
Commit
31dbb4e1
authored
6 years ago
by
Peter Joseph De Jonckheere CESM2014
Browse files
Options
Downloads
Patches
Plain Diff
Needed to accept permissions
parent
cd88dcdc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/AndroidManifest.xml
+4
-0
4 additions, 0 deletions
src/main/AndroidManifest.xml
src/main/java/com/notificationFramework/sedentary/frontEnd/SaveFile.java
+7
-4
7 additions, 4 deletions
...om/notificationFramework/sedentary/frontEnd/SaveFile.java
with
11 additions
and
4 deletions
src/main/AndroidManifest.xml
+
4
−
0
View file @
31dbb4e1
...
...
@@ -9,6 +9,7 @@
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
...
...
@@ -21,6 +22,9 @@
<meta-data
android:name=
"com.google.android.awareness.API_KEY"
android:value=
"AIzaSyDqliqBcEQQAvMZR-RengdLUJaAYeRKbgs"
/>
<meta-data
android:name=
"com.google.android.geo.API_KEY"
android:value=
"AIzaSyDqliqBcEQQAvMZR-RengdLUJaAYeRKbgs"
/>
<meta-data
android:name=
"com.google.android.gms.version"
android:value=
"@integer/google_play_services_version"
/>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/notificationFramework/sedentary/frontEnd/SaveFile.java
+
7
−
4
View file @
31dbb4e1
...
...
@@ -9,6 +9,7 @@ import android.util.Log;
import
com.google.android.gms.awareness.Awareness
;
import
com.google.android.gms.awareness.AwarenessStatusCodes
;
import
com.google.android.gms.awareness.snapshot.HeadphoneStateResponse
;
import
com.google.android.gms.awareness.snapshot.LocationResponse
;
import
com.google.android.gms.awareness.snapshot.PlacesResponse
;
import
com.google.android.gms.awareness.snapshot.WeatherResponse
;
...
...
@@ -358,18 +359,20 @@ public class SaveFile {
.
addApi
(
Awareness
.
getSnapshotClient
(
context
).
getApi
()).
build
();
client
.
connect
();
try
{
Awareness
.
getSnapshotClient
(
context
).
getHeadphoneState
().
addOnCompleteListener
(
new
OnCompleteListener
<
HeadphoneStateResponse
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
HeadphoneStateResponse
>
task
)
{
task
.
getResult
().
getHeadphoneState
().
getState
();
}
});
Awareness
.
getSnapshotClient
(
context
).
getLocation
().
addOnCompleteListener
(
new
OnCompleteListener
<
LocationResponse
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
LocationResponse
>
task
)
{
SharedPreferences
preferences
=
context
.
getSharedPreferences
(
context
.
getString
(
R
.
string
.
preference_file_key
),
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
try
{
editor
.
putLong
(
context
.
getString
(
R
.
string
.
store_lat
),
Double
.
doubleToLongBits
(
task
.
getResult
().
getLocation
().
getLatitude
()));
editor
.
putLong
(
context
.
getString
(
R
.
string
.
store_long
),
Double
.
doubleToLongBits
(
task
.
getResult
().
getLocation
().
getLongitude
()));
}
catch
(
RuntimeExecutionException
e
){
Log
.
d
(
"ERROR"
,
e
.
getMessage
());
}
editor
.
commit
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment