Repository: flex-asjs Updated Branches: refs/heads/develop 5de310ca2 -> ad9db1373
Added geolocation.Geolocation package/class to the org.apache.cordova package in the Mobile framework project. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ad9db137 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ad9db137 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ad9db137 Branch: refs/heads/develop Commit: ad9db13737f13340f4d514a66ecd50cfd55a7abc Parents: 5de310c Author: Peter Ent <[email protected]> Authored: Tue Jun 21 10:19:49 2016 -0400 Committer: Peter Ent <[email protected]> Committed: Tue Jun 21 10:19:49 2016 -0400 ---------------------------------------------------------------------- .../Mobile/src/main/flex/CordovaClasses.as | 3 +- .../apache/cordova/geolocation/Geolocation.as | 48 ++++++++++++++++++++ .../src/main/resources/cordova-manifest.xml | 1 + 3 files changed, 51 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9db137/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as b/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as index 3b9dc98..1c0b98e 100644 --- a/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as +++ b/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as @@ -26,10 +26,11 @@ package * from the classes specified in manifest.xml. */ internal class CordovaClasses -{ +{ import org.apache.cordova.camera.Camera; Camera; import org.apache.cordova.Application; Application; import org.apache.cordova.Weinre; Weinre; + import org.apache.cordova.geolocation.Geolocation; Geolocation; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9db137/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/geolocation/Geolocation.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/geolocation/Geolocation.as b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/geolocation/Geolocation.as new file mode 100644 index 0000000..c193413 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/geolocation/Geolocation.as @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.cordova.geolocation +{ + /** + * Geolocation provides the interface to the Cordova Geolocation plugin. + */ + + [Mixin] + public class Geolocation + { + /** + * Constructor + */ + public function Geolocation() + { + } + + /** + * Gets the device current location. If successful, the onSuccess function is + * called with position parameter (see Cordova documentation). If failure, the + * onError function is called with an error parameter (.code and .message members). + */ + public function getCurrentPosition(onSuccess:Function, onError:Function):void + { + COMPILE::JS { + // TODO: (pent) Cordova externs + navigator["geolocation"].getCurrentPosition(onSuccess, onError); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9db137/frameworks/projects/Mobile/src/main/resources/cordova-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/resources/cordova-manifest.xml b/frameworks/projects/Mobile/src/main/resources/cordova-manifest.xml index 002eed1..d20b9ff 100644 --- a/frameworks/projects/Mobile/src/main/resources/cordova-manifest.xml +++ b/frameworks/projects/Mobile/src/main/resources/cordova-manifest.xml @@ -24,5 +24,6 @@ <component id="Application" class="org.apache.cordova.Application"/> <component id="Camera" class="org.apache.cordova.camera.Camera"/> <component id="Weinre" class="org.apache.cordova.Weinre"/> + <component id="Geolocation" class="org.apache.cordova.geolocation.Geolocation" /> </componentPackage>
