Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
52cf2891
Commit
52cf2891
authored
May 31, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to using real location data (#4282)
parent
8c805e23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
LocationProvider.m
examples/hello_services/ios/HelloServices/LocationProvider.m
+14
-3
main.dart
examples/hello_services/lib/main.dart
+3
-3
No files found.
examples/hello_services/ios/HelloServices/LocationProvider.m
View file @
52cf2891
...
...
@@ -4,7 +4,11 @@
#import "LocationProvider.h"
@implementation
LocationProvider
#import <CoreLocation/CoreLocation.h>
@implementation
LocationProvider
{
CLLocationManager
*
_locationManager
;
}
@synthesize
messageName
=
_messageName
;
...
...
@@ -16,9 +20,16 @@
}
-
(
NSString
*
)
didReceiveString
:
(
NSString
*
)
message
{
if
(
_locationManager
==
nil
)
{
_locationManager
=
[[
CLLocationManager
alloc
]
init
];
[
_locationManager
startMonitoringSignificantLocationChanges
];
}
CLLocation
*
location
=
_locationManager
.
location
;
NSDictionary
*
response
=
@{
@"latitude"
:
@
3.29334
,
@"longitude"
:
@
8.2492492
@"latitude"
:
@
(
location
.
coordinate
.
latitude
)
,
@"longitude"
:
@
(
location
.
coordinate
.
longitude
),
};
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
response
options
:
0
error
:
nil
];
...
...
examples/hello_services/lib/main.dart
View file @
52cf2891
...
...
@@ -57,10 +57,10 @@ class _HelloServicesState extends State<HelloServices> {
}
void
_onReceivedLocation
(
String
json
)
{
Map
<
String
,
double
>
reply
=
JSON
.
decode
(
json
);
Map
<
String
,
num
>
reply
=
JSON
.
decode
(
json
);
setState
(()
{
_latitude
=
reply
[
'latitude'
];
_longitude
=
reply
[
'longitude'
];
_latitude
=
reply
[
'latitude'
]
.
toDouble
()
;
_longitude
=
reply
[
'longitude'
]
.
toDouble
()
;
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment