Giter Site home page Giter Site logo

Comments (14)

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

可以,后台运行建议使用

geolocation.watchPosition

而不是

geolocation.getCurrentPosition

from cordova-plugin-geolocation-baidu.

zuomoumou666 avatar zuomoumou666 commented on July 24, 2024

@zhouzhongyuan 您好,我没有在您的插件里看到百度地图SDK 的key的填写处。那怎么使用呢

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

@zuomoumou666

cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-geolocation-baidu --variable BAIDUMAPKEY="<API_KEY>"

注:API_KEY不带左右尖括号

我的文档没有更新,是我的问题。今天会更新的。

from cordova-plugin-geolocation-baidu.

zuomoumou666 avatar zuomoumou666 commented on July 24, 2024

多谢,不过好像生成插件plugin.xml文件里还是没有相应的KEY,还有,只有Android版本吗?

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

这个版本是iOS 和Android都有的。
你在iOS上遇到什么问题了吗?

from cordova-plugin-geolocation-baidu.

zuomoumou666 avatar zuomoumou666 commented on July 24, 2024

哦,好像是你给我的命令写错了,能不能给个联系方式,这样沟通不顺畅。谢谢

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

使用如下命令即可正确安装(我刚刚自己验证过了),刚才给你说的方式确实是错误的,sorry。
别忘了把<API_KEY>换成你自己的key

cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-geolocation-baidu --variable BAIDUMAPKEY="<API_KEY>"

from cordova-plugin-geolocation-baidu.

zuomoumou666 avatar zuomoumou666 commented on July 24, 2024

我还是要麻烦你,我这样安装成功了:cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-geolocation-baidu.git --variable BAIDUMAPKEY="i4TGPjBy3V5cGsfGSaCgHC4p"
还是在plugin.xml文件里搜索不到这个key,是不是我clone的分支不应该是master?

<name>Geolocation</name>
<description>Cordova Geolocation Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,geolocation</keywords>
<repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git</repo>
<issue>https://issues.apache.org/jira/browse/CB/component/12320638</issue>
<preference name="BAIDUMAPKEY" />
<!-- android -->
<platform name="android">

    <config-file target="AndroidManifest.xml" parent="/*">
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    </config-file>

    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="Geolocation">
          <param name="android-package" value="org.apache.cordova.geolocation.Geolocation" />
      </feature>
    </config-file>

    <source-file src="src/android/Geolocation.java" target-dir="src/org/apache/cordova/geolocation/" />
    <source-file src="src/android/PermissionHelper.java" target-dir="src/org/apache/cordova/geolocation/" />

    <js-module src="www/android/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>

    <!-- We don't expose PositionError via clobber on Android as we use it internally only -->
    <js-module src="www/PositionError.js" name="PositionError">
        <runs />
    </js-module>

</platform>

 <!-- amazon-fireos -->
<platform name="amazon-fireos">

    <config-file target="AndroidManifest.xml" parent="/*">
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    </config-file>

</platform>

<!-- ios -->
<platform name="ios">
    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>

    <config-file target="config.xml" parent="/*">
            <feature name="Geolocation">
                <param name="ios-package" value="CDVLocation"/>
            </feature>
            <preference name="BAIDUMAPKEY" value="$BAIDUMAPKEY" />
    </config-file>
    <!--<config-file target="*-Info.plist" parent="CFBundleURLTypes">-->
        <!--<array>-->
            <!--<dict>-->
                <!--<key>CFBundleURLName</key>-->
                <!--<string>weixin</string>-->
                <!--<key>CFBundleURLSchemes</key>-->
                <!--<array>-->
                    <!--<string>$WECHATAPPID</string>-->
                <!--</array>-->
            <!--</dict>-->
        <!--</array>-->
    <!--</config-file>-->
    <config-file target="*-Info.plist" parent="CFBundleURLTypes">
        <array>
            <dict>
                <key>CFBundleURLName</key>
                <string>baidumap</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>$BAIDUMAPKEY</string>
                </array>
            </dict>
        </array>
    </config-file>
    <header-file src="src/ios/CDVLocation.h" />
    <source-file src="src/ios/CDVLocation.m" />
    <framework src="CoreLocation.framework" />

    // before xcode7
    <framework src="CoreLocation.framework" />
    <framework src="QuartzCore.framework" />
    <framework src="OpenGLES.framework" />
    <framework src="SystemConfiguration.framework" />
    <framework src="CoreGraphics.framework" />
    <framework src="Security.framework" />
    // after xcode7
    <framework src="libsqlite3.0.tbd" />
    <framework src="src/ios/libs/CoreTelephony.framework" />
    <framework src="src/ios/libs/libstdc++.6.0.9.tbd"  />
    // baidu framework
    <framework src="src/ios/libs/BaiduMapAPI_Base.framework" custom="true" />
    <framework src="src/ios/libs/BaiduMapAPI_Location.framework" custom="true" />
    <config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
        <string></string>
    </config-file>


</platform>

<!-- blackberry10 -->
<platform name="blackberry10">

    <js-module src="www/blackberry10/GeolocationProxy.js" name="GeolocationProxy">
        <runs />
    </js-module>

    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>

    <config-file target="www/config.xml" parent="/widget">
        <feature name="Geolocation" value="Geolocation"/>
    </config-file>

    <config-file target="www/config.xml" parent="/widget/rim:permissions">
      <rim:permit>read_geolocation</rim:permit>
    </config-file>

</platform>

<!-- ubuntu -->
<platform name="ubuntu">
    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>

    <source-file src="src/ubuntu/geolocation.cpp" />
    <header-file src="src/ubuntu/geolocation.h" />
    <config-file target="config.xml" parent="/*">
        <feature name="Geolocation">
            <param policy_group="location" policy_version="1" />
        </feature>
    </config-file>
</platform>

<!-- wp7 -->
<platform name="wp7">

    <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
        <Capability Name="ID_CAP_LOCATION" />
    </config-file>

    <source-file src="src/wp/Geolocation.cs" />
</platform>

<!-- wp8 -->
<platform name="wp8">

    <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
        <Capability Name="ID_CAP_LOCATION" />
    </config-file>

    <source-file src="src/wp/Geolocation.cs" />
</platform>

<!-- windows8 -->
<platform name="windows8">
    <config-file target="package.appxmanifest" parent="/Package/Capabilities">
        <DeviceCapability Name="location" />
    </config-file>

    <js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
        <runs />
    </js-module>

    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>
</platform>

<!-- windows universal apps (Windows 8.1, Windows Phone 8.1, Windows 8.0) -->
<platform name="windows">
    <config-file target="package.appxmanifest" parent="/Package/Capabilities">
        <DeviceCapability Name="location" />
    </config-file>

    <js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
        <runs />
    </js-module>

    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>
</platform>

<!-- firefoxos -->
<platform name="firefoxos">
  <config-file target="config.xml" parent="/*">
      <permission name="geolocation" description="Required for accessing user location." />
  </config-file>

    <js-module src="src/firefoxos/GeolocationProxy.js" name="GeolocationProxy">
        <runs />
    </js-module>

    <js-module src="www/Coordinates.js" name="Coordinates">
        <clobbers target="Coordinates" />
    </js-module>

    <js-module src="www/PositionError.js" name="PositionError">
        <clobbers target="PositionError" />
    </js-module>

    <js-module src="www/Position.js" name="Position">
        <clobbers target="Position" />
    </js-module>

    <js-module src="www/geolocation.js" name="geolocation">
        <clobbers target="navigator.geolocation" />
    </js-module>
</platform>

from cordova-plugin-geolocation-baidu.

zuomoumou666 avatar zuomoumou666 commented on July 24, 2024

@zhouzhongyuan 而且build Android的时候还有个错误,你的PermissionHelper.java文件not found

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

@zuomoumou666 稍等哈 我把这个project重新提交一下。

from cordova-plugin-geolocation-baidu.

GoToBoy avatar GoToBoy commented on July 24, 2024

还是报 PermissionHelper.java文件not found 😳

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

android 先使用这个
[https://github.com/zhouzhongyuan/cordova-plugin-geo-baidu]

from cordova-plugin-geolocation-baidu.

GoToBoy avatar GoToBoy commented on July 24, 2024

这个用了,只有get current position, 里面的类名写成sb 也是醉了,而且还把所有数据拼成string类型~简直是

from cordova-plugin-geolocation-baidu.

zhouzhongyuan avatar zhouzhongyuan commented on July 24, 2024

1.只有getCurrentPostion
2.里面的类名我不清楚,fork别人的,
3.返回的数据与cordova-plugin-geolocation完全一致,(你说的返回string,应该是原作者的)。请看Readme,这点我已经说过了
@GoToBoy

from cordova-plugin-geolocation-baidu.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.