Coder Social home page Coder Social logo

mapkit's Introduction

MapKit plugin for iOS and Android

Uses Apple Maps on iOS and Google Maps v2 on Android

Currently only works/tested on Android and iOS. Requires Cordova 3.0+ (will not work on earlier versions without modifications).

Cordova Map 1

Cordova Map 2

Cordova Map 3

Cordova Map 4

Android specific

You need a Google Maps Android v2 API KEY from google and you need to specify it when you install the plugin

You can install this plugin with plugman

plugman install --platform android --project android-mapkit-example/ --plugin /path/to/MapKit --variable API_KEY="YOUR_API_KEY_FROM_GOOGLE"

or with cordova CLI

cordova -d plugin add /path/to/MapKit --variable API_KEY="YOUR_API_KEY_FROM_GOOGLE"

(/path/to/MapKit could be the git repository https://github.com/imhotep/MapKit)

Follow the instructions that are displayed after you install the plugin.

Sample code

var app = {
    showMap: function() {
        var pins = [
        {
            lat: 49.28115,
            lon: -123.10450,
            title: "A Cool Title",
            snippet: "A Really Cool Snippet",
            icon: mapKit.iconColors.HUE_ROSE
        },
        {
            lat: 49.27503,
            lon: -123.12138,
            title: "A Cool Title, with no Snippet",
            icon: {
              type: "asset",
              resource: "www/img/logo.png", //an image in the asset directory
              pinColor: mapKit.iconColors.HUE_VIOLET //iOS only
            }
        },
        {
            lat: 49.28286,
            lon: -123.11891,
            title: "Awesome Title",
            snippet: "Awesome Snippet",
            icon: mapKit.iconColors.HUE_GREEN
        }];
        var error = function() {
          console.log('error');
        };
        var success = function() {
          mapKit.addMapPins(pins, function() {
                                      console.log('adMapPins success');
                                  },
                                  function() { console.log('error'); });
        };
        mapKit.showMap(success, error);
    },
    hideMap: function() {
        var success = function() {
          console.log('Map hidden');
        };
        var error = function() {
          console.log('error');
        };
        mapKit.hideMap(success, error);
    },
    clearMapPins: function() {
        var success = function() {
          console.log('Map Pins cleared!');
        };
        var error = function() {
          console.log('error');
        };
        mapKit.clearMapPins(success, error);
    },
    changeMapType: function() {
        var success = function() {
          console.log('Map Type Changed');
        };
        var error = function() {
          console.log('error');
        };
        mapKit.changeMapType(mapKit.mapType.MAP_TYPE_SATELLITE, success, error);
    }
}

Configuration

You can override the options by passing a suitable options object as arguments to showMap

var options = {
    height: 460,      // height of the map (width is always full size for now)
    diameter: 1000,   // unused for now
    atBottom: true,   // bottom or top of the webview
    lat: 49.281468,   // initial camera position latitude
    lon: -123.104446  // initial camera position latitude
};

Sample App

Checkout the sample/ application as a boilerplate!

Missing features

Info bubbles: Simple info bubbles supported (title, snippet and custom icons for markers). Custom info bubbles not supported (i.e HTML bubbles etc..).

License

Apache

Credits for iOS

  • Brett Rudd @goya
  • Becky Gibson @becka11y

mapkit's People

Contributors

dun3 avatar everplays avatar imhotep avatar johnjohndoe avatar lholmquist avatar sebastianzillessen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapkit's Issues

Cannot modify default opening position on map

I've got the map embedded on iOS but cannot change the default location.

I tried changing (in MapKit.js)

var MapKit = function() {
this.options = {
height: 260,
diameter: 1000,
atBottom: true,
lat: 33.281468,
lon: -71.104446
};

the lat and lon to different values but the map always opens to the same location.

What am I doing wrong here?

Cheers,

mapkit.js not loaded?

I am newbie, sorry in the case the issue is insignificant:

I followed all the steps in the readme and installed the plugin with plugman. Further followed all the steps descriped in the console.

Do I need to copy mapkit.js in the www/js folder or declare it somewhere? i cannot find it in the builded app.

Building android with cordova (3.3.1-0.1.2) cli

Thank you all in advance

iOS Map click listener

When User taps the map, i need to get the location (latitude and longitude) and add pin over it, I don't find any map click listener to handle this function. Please help ASAP.

link on Pins

is possible redirect in the other page when i click on the Pins in the maps?

Pins not showing

I have used the sample code as it is. The map opens but the pins will not show

Android Setup missing in Readme?

Hi Anis!

Thanks for your nice map plugin. I have it running already without any problem on iOS, but somehow I'm not getting it to work on Android. I walked through the Android Maps setup guide (https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api), but always get errors during the build that it doesn't find the package "com.google.android.gms.common". Is there somewhere a sample android project I can have a look at, what I've configured wrong?

Thanks for every hint!

Best,

Christoph

CDVPlugin Error Using Appgyver Steroids

Hi All,

I've been trying to get the MapKit plugin to work for my simple Appgyver Steroids project, but I keep getting the same error no matter what I try:

ERROR: Plugin 'MapKit' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.

I have the Mapkit plugin added to my project, using the following command:

cordova plugins add com.phonegap.plugins.mapkit

If I list my cordova plugins I get all of my installed plugins...

com.phonegap.plugins.mapkit 0.9.2 "MapKit"
org.apache.cordova.dialogs 0.2.9 "Notification"
org.apache.cordova.geolocation 0.3.9 "Geolocation"
org.apache.cordova.vibration 0.3.10 "Vibration"

I think the problem is in my config.xml, but I'm not really sure how to map the plugins correctly. This is how my config.xml looks at the moment:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.appgyver.helloSteroids" version="3.1.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>TestApp</name>
    <description>
        A fresh new Steroids application.
    </description>
    <author email="[email protected]" href="http://www.appgyver.com/steroids">
        AppGyver Steroids Team
    </author>

    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="MapKit">
        <param name="ios-package" value="CDVLocation" />
    </feature>

    <access origin="*" />

</widget>

I'm not really sure what to do here and could really use the help!

resolve to a path with no project.properties file for project

/Users/alexander/Projects/android_sdk/tools/ant/build.xml:577: /Users/alexander/Projects/android_sdk/extras/google/google_play_services/libproject/google-play-services_lib/ resolve to a path with no project.properties file for project /Users/alexander/Projects/test_app/platforms/android

Pin clustering in iOS

I know this project has been a little neglected, but it's still the best solution for native maps on iOS for cordova projects.

Would anyone know how to integrate pin clusters into this plugin for iOS? I've installed this pod https://github.com/choefele/CCHMapClusterController but not sure how to get it working with this plugin. Any help would be appreciated.

app crash sometimes when closing map (android)

Sometimes the app crashes when doing mapHide()

W/dalvikvm( 6250): threadid=1: thread exiting with uncaught exception (group=0x4184cda0)
E/AndroidRuntime( 6250): FATAL EXCEPTION: main
E/AndroidRuntime( 6250): Process: com.superapp.SuperApp, PID: 6250
E/AndroidRuntime( 6250): java.lang.NullPointerException
E/AndroidRuntime( 6250): at com.phonegap.plugins.mapkit.MapKit$4.run(MapKit.java:369)
E/AndroidRuntime( 6250): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 6250): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 6250): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 6250): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime( 6250): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6250): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 6250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime( 6250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime( 6250): at dalvik.system.NativeStart.main(Native Method)

API Key

So, if I cannot use cordova plugin add with the --variable option, then where would I manually have to place the API Key?

phonegap 3.0

I have a problem with phonegap 3.0 ...
-> exec() call to unknow plugin : MapKit

will be there a stable version for PhoneGap 3.0?

for example:

this
"import org.apache.cordova.io.CordovaWebView"
was changed in this
"import org.apache.cordova.CordovaWebView"

Change map center

Hello, is it possible to change map center after the map is initialized?

app crashes

I get this when I try to showMap:

E/AndroidRuntime( 568): java.lang.NullPointerException: CameraUpdateFactory is not initialized

Mapkit on android

Im having issues with MapKit on android. It compiles ok after doing the suggested things in the readme. The problem I am having is that it fails - not running the success or the fail callbacks.

I get nothing no positive or negative feedback. Or any map. Also its fine on ios.

API method

Is there a method who search pois near my position by API?

Error building android platform

Hey guys, while building throws this error:

Compiling app on platform "android" via command "/Users/nicolas/Sites/guider/guider/platforms/android/cordova/build"
[Error: An error occurred while building the android project.Error executing "ant debug -f /Users/nicolas/Sites/guider/guider/platforms/android/build.xml":
BUILD FAILED
/Users/nicolas/adt-bundle-mac/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/nicolas/adt-bundle-mac/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 1 second

my phonegap version

3.2.0-0.16.0

Only with this plugin.

Manifest problem

    android:value="@integer/google_play_services_version" this parameter gives error when compiling, how can I solve it?

Adding Markers fails

If I call

mapKit.addMapPins([[51.49,7.00]], function() { 
                                  console.log('adMapPins success');  
                              },
                              function() { console.log('error'); });

I get an error at the console saying:

W/System.err(15271): org.json.JSONException: Value [51.49,7] at 0 of type org.json.JSONArray cannot be converted to JSONObject
W/System.err(15271):    at org.json.JSON.typeMismatch(JSON.java:100)
W/System.err(15271):    at org.json.JSONArray.getJSONObject(JSONArray.java:484)
W/System.err(15271):    at com.phonegap.plugins.mapkit.MapKit$3.run(MapKit.java:154)
W/System.err(15271):    at android.os.Handler.handleCallback(Handler.java:730)
W/System.err(15271):    at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err(15271):    at android.os.Looper.loop(Looper.java:137)
W/System.err(15271):    at android.app.ActivityThread.main(ActivityThread.java:5103)
W/System.err(15271):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(15271):    at java.lang.reflect.Method.invoke(Method.java:525)
W/System.err(15271):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
W/System.err(15271):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
W/System.err(15271):    at dalvik.system.NativeStart.main(Native Method)
E/MapKitPlugin(15271): An error occurred while reading pins

google-play-services-admob.jar and mapkit?

I get this error when compiling:

   [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
   [dx] com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
   [dx]     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
   [dx]     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
   [dx]     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
   [dx]     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
   [dx]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
   [dx]     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
   [dx]     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
   [dx]     at com.android.dx.command.dexer.Main.run(Main.java:230)
   [dx]     at com.android.dx.command.dexer.Main.main(Main.java:199)
   [dx]     at com.android.dx.command.Main.main(Main.java:103)
   [dx] 

But I do need google-play-services-admob.jar aswell for my ads... Any ideas to what I can do?

Buttons and famo.us

Hi there,

I was just wondering if I can overlay Buttons in Android or iOS without having to program on the native side.
The second question is: Can I use your plugin in famo.us (http://famo.us)?

Best regards

Show pin info opened

How can I display the tooltip opened over the pin when I create it? There is any way? Thanks

iOS: config.xml

I use

<plugin name="MapKit" value="MapKitView" />

That should be mentioned in readme.md

Failing Build with Cordova 3.4

I have follow the steps on #18. I have install API19 and all extras, included Google Play Services. When I try to run it for android, I get this issue:

-pre-compile:
[echo] Set jars path to: C:\cordova\prueba\platforms\android\CordovaLib\ant-build\classes.jar;C:\adt-bundle\sdk\extras\google\google_play_services\libproject\google-play-services_lib\ant-build\classes.jar;C:\adt-bundle\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google-play-services.jar

-compile:
[javac] Compiling 6 source files to c:\cordova\prueba\platforms\android\ant-build\classes
[javac] c:\cordova\prueba\platforms\android\src\com\phonegap\plugins\mapkit\MapKit.java:73: error: exception GooglePlayServicesNotAvailableException is never thrown in body of corresponding try statement
[javac] } catch (GooglePlayServicesNotAvailableException e) {
[javac] ^
[javac] 1 error

Any idea? Thanks!

iOS Support

Hi! Nice work!

Referring to the readme "Currently only works/tested on Android. iOS is currently outdated and DOES NOT WORK."

Does this mean that it does not work for Cordova 2.6.0 but with older Cordova? Or doesn't work at all?

Have you tried https://github.com/bhurlow/cordova-mapkit ?

compile error

trying to run 'cordova build android --release'

MapKit.java:73: exception com.google.android.gms.common.GooglePlayServicesNotAvailableException is never thrown in body of corresponding try statement
[javac] } catch (GooglePlayServicesNotAvailableException e) {
[javac] ^
[javac] 1 error

BUILD FAILED
/Users/alexander/Projects/android_sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/alexander/Projects/android_sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 4 seconds
Error code 1 for command: ant with args: release,-f,/Users/alexander/Projects/politikontroller/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/alexander/Projects/politikontroller/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

Only green/purple/red are supported

Looks like there's a restriction on what map pins work:

if ([phAnnotation.pinColor isEqualToString:@"120"])
    annView.pinColor = MKPinAnnotationColorGreen;
else if ([phAnnotation.pinColor isEqualToString:@"270"])
    annView.pinColor = MKPinAnnotationColorPurple;
else
    annView.pinColor = MKPinAnnotationColorRed;

Ios custom icons

It's possible set custom icons on ios version??

var pins = [{
    lat: 49.27503,
    lon: -123.12138,
    title: "A Cool Title, with no Snippet",
    icon: {
        type: "asset",
        resource: "www/img/logo.png", //an image in the asset directory
        pinColor: mapKit.iconColors.HUE_VIOLET //iOS only
    }
}];

"logo.png" isn't loaded...

Thanksss

iOS JavaScript callback

To get the pin label 'more' button onclick functionality working, add a few lines to the createViewWithOptions method in MapKit.m:

 if ([options objectForKey:@"buttonCallback"])
{
    self.buttonCallback=[[options objectForKey:@"buttonCallback"] description];
}

The rest of the required code is already present in MapKit.m.
Then, in JavaScript add the name of the callback method to the options object:

this.options = {
    height: 460,
    diameter: 1000,
    atBottom: true,
    lat: 49.281468,
    lon: -123.104446,
    buttonCallback: "myCallback"
};

The callback method receives the index of the selected pin.

Not really an issue, just a note. Perhaps it helps someone.

Failing Build with Cordova 3.1

Hello.
I'm just testing your plugin with Cordova 3.1.

I created a sample application by

cordova create Test
cd Test
cordova platforms add android
...

and added some plugins...

cordova plugin add com.phonegap.plugins.mapkit

No if I try to build the application I get the following errors:


[Error: An error occurred while building the android project. Buildfile: /Users/user/Entwicklung/2.0/Test/platforms/android/build.xml

-check-env:
 [checkenv] Android SDK Tools Revision 22.2.1
 [checkenv] Installed at /Users/user/.adt

-setup:
     [echo] Project Name: HelloCordova
  [gettype] Project Type: Application

-pre-clean:

clean:
   [delete] Deleting directory /Users/user/Entwicklung/2.0/Test/platforms/android/bin
   [delete] Deleting directory /Users/user/Entwicklung/2.0/Test/platforms/android/gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
   [subant] No sub-builds to iterate on

BUILD SUCCESSFUL
Total time: 0 seconds
Buildfile: /Users/user/Entwicklung/2.0/Test/platforms/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 22.2.1
 [checkenv] Installed at /Users/user/.adt

-setup:
     [echo] Project Name: HelloCordova
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 18.1.0
     [echo] Resolving Build Target for HelloCordova...
[gettarget] Project Target:   Android 4.2.2
[gettarget] API level:        17
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/res
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/rsObj
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/rsLibs
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/gen
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/classes
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for HelloCordova...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 20 source files to /Users/user/Entwicklung/2.0/Test/platforms/android/bin/classes
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:18: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.ConnectionResult;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:19: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.GooglePlayServicesUtil;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:20: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:21: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.CameraUpdateFactory;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:22: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.GoogleMapOptions;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:23: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.MapView;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:24: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.MapsInitializer;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:25: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.LatLng;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:26: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.MarkerOptions;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:27: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.BitmapDescriptor;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:28: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.BitmapDescriptorFactory;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:34: cannot find symbol
    [javac] symbol  : class MapView
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]     protected MapView mapView;
    [javac]               ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:198: cannot find symbol
    [javac] symbol  : class BitmapDescriptor
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]     private BitmapDescriptor getBitmapDescriptor( final JSONObject iconOption ) {
    [javac]             ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:61: cannot find symbol
    [javac] symbol: variable GooglePlayServicesUtil
    [javac]                     final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity());
    [javac]                                            ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:62: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                     if (resultCode == ConnectionResult.SUCCESS) {
    [javac]                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:63: cannot find symbol
    [javac] symbol: class MapView
    [javac]                         mapView = new MapView(cordova.getActivity(),
    [javac]                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:64: cannot find symbol
    [javac] symbol: class GoogleMapOptions
    [javac]                                 new GoogleMapOptions());
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:72: cannot find symbol
    [javac] symbol: variable MapsInitializer
    [javac]                             MapsInitializer.initialize(cordova.getActivity());
    [javac]                             ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:73: cannot find symbol
    [javac] symbol: class GooglePlayServicesNotAvailableException
    [javac]                         } catch (GooglePlayServicesNotAvailableException e) {
    [javac]                                  ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:97: cannot find symbol
    [javac] symbol: class LatLng
    [javac]                                 CameraUpdateFactory.newLatLngZoom(new LatLng(
    [javac]                                                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:97: cannot find symbol
    [javac] symbol: variable CameraUpdateFactory
    [javac]                                 CameraUpdateFactory.newLatLngZoom(new LatLng(
    [javac]                                 ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:101: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                     } else if (resultCode == ConnectionResult.SERVICE_MISSING ||
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:102: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                                resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED ||
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:103: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                                resultCode == ConnectionResult.SERVICE_DISABLED) {
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:104: cannot find symbol
    [javac] symbol: variable GooglePlayServicesUtil
    [javac]                         Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, cordova.getActivity(), 1,
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:158: cannot find symbol
    [javac] symbol: class MarkerOptions
    [javac]                                 MarkerOptions mOptions = new MarkerOptions();
    [javac]                                 ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:158: cannot find symbol
    [javac] symbol: class MarkerOptions
    [javac]                                 MarkerOptions mOptions = new MarkerOptions();
    [javac]                                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:160: cannot find symbol
    [javac] symbol: class LatLng
    [javac]                                 mOptions.position(new LatLng(latitude,
    [javac]                                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:169: cannot find symbol
    [javac] symbol: class BitmapDescriptor
    [javac]                                     BitmapDescriptor bDesc = getBitmapDescriptor(options);
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:208: cannot find symbol
    [javac] symbol  : variable BitmapDescriptorFactory
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]                         return BitmapDescriptorFactory.fromAsset(resource);
    [javac]                                ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:213: cannot find symbol
    [javac] symbol  : variable BitmapDescriptorFactory
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]                 return BitmapDescriptorFactory.defaultMarker(Float.parseFloat(o.toString()));
    [javac]                        ^
    [javac] 31 errors

BUILD FAILED
/Users/user/.adt/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/user/.adt/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 2 seconds
ERROR: Failed to build android project.
Buildfile: /Users/user/Entwicklung/2.0/Test/platforms/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 22.2.1
 [checkenv] Installed at /Users/user/.adt

-setup:
     [echo] Project Name: HelloCordova
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 18.1.0
     [echo] Resolving Build Target for HelloCordova...
[gettarget] Project Target:   Android 4.2.2
[gettarget] API level:        17
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/res
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/rsObj
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/rsLibs
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/gen
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/classes
    [mkdir] Created dir: /Users/user/Entwicklung/2.0/Test/platforms/android/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for HelloCordova...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 20 source files to /Users/user/Entwicklung/2.0/Test/platforms/android/bin/classes
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:18: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.ConnectionResult;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:19: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.GooglePlayServicesUtil;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:20: package com.google.android.gms.common does not exist
    [javac] import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:21: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.CameraUpdateFactory;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:22: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.GoogleMapOptions;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:23: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.MapView;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:24: package com.google.android.gms.maps does not exist
    [javac] import com.google.android.gms.maps.MapsInitializer;
    [javac]                                   ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:25: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.LatLng;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:26: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.MarkerOptions;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:27: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.BitmapDescriptor;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:28: package com.google.android.gms.maps.model does not exist
    [javac] import com.google.android.gms.maps.model.BitmapDescriptorFactory;
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:34: cannot find symbol
    [javac] symbol  : class MapView
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]     protected MapView mapView;
    [javac]               ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:198: cannot find symbol
    [javac] symbol  : class BitmapDescriptor
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]     private BitmapDescriptor getBitmapDescriptor( final JSONObject iconOption ) {
    [javac]             ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:61: cannot find symbol
    [javac] symbol: variable GooglePlayServicesUtil
    [javac]                     final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity());
    [javac]                                            ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:62: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                     if (resultCode == ConnectionResult.SUCCESS) {
    [javac]                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:63: cannot find symbol
    [javac] symbol: class MapView
    [javac]                         mapView = new MapView(cordova.getActivity(),
    [javac]                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:64: cannot find symbol
    [javac] symbol: class GoogleMapOptions
    [javac]                                 new GoogleMapOptions());
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:72: cannot find symbol
    [javac] symbol: variable MapsInitializer
    [javac]                             MapsInitializer.initialize(cordova.getActivity());
    [javac]                             ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:73: cannot find symbol
    [javac] symbol: class GooglePlayServicesNotAvailableException
    [javac]                         } catch (GooglePlayServicesNotAvailableException e) {
    [javac]                                  ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:97: cannot find symbol
    [javac] symbol: class LatLng
    [javac]                                 CameraUpdateFactory.newLatLngZoom(new LatLng(
    [javac]                                                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:97: cannot find symbol
    [javac] symbol: variable CameraUpdateFactory
    [javac]                                 CameraUpdateFactory.newLatLngZoom(new LatLng(
    [javac]                                 ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:101: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                     } else if (resultCode == ConnectionResult.SERVICE_MISSING ||
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:102: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                                resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED ||
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:103: cannot find symbol
    [javac] symbol: variable ConnectionResult
    [javac]                                resultCode == ConnectionResult.SERVICE_DISABLED) {
    [javac]                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:104: cannot find symbol
    [javac] symbol: variable GooglePlayServicesUtil
    [javac]                         Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, cordova.getActivity(), 1,
    [javac]                                         ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:158: cannot find symbol
    [javac] symbol: class MarkerOptions
    [javac]                                 MarkerOptions mOptions = new MarkerOptions();
    [javac]                                 ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:158: cannot find symbol
    [javac] symbol: class MarkerOptions
    [javac]                                 MarkerOptions mOptions = new MarkerOptions();
    [javac]                                                              ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:160: cannot find symbol
    [javac] symbol: class LatLng
    [javac]                                 mOptions.position(new LatLng(latitude,
    [javac]                                                       ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:169: cannot find symbol
    [javac] symbol: class BitmapDescriptor
    [javac]                                     BitmapDescriptor bDesc = getBitmapDescriptor(options);
    [javac]                                     ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:208: cannot find symbol
    [javac] symbol  : variable BitmapDescriptorFactory
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]                         return BitmapDescriptorFactory.fromAsset(resource);
    [javac]                                ^
    [javac] /Users/user/Entwicklung/2.0/Test/platforms/android/src/com/phonegap/plugins/mapkit/MapKit.java:213: cannot find symbol
    [javac] symbol  : variable BitmapDescriptorFactory
    [javac] location: class com.phonegap.plugins.mapkit.MapKit
    [javac]                 return BitmapDescriptorFactory.defaultMarker(Float.parseFloat(o.toString()));
    [javac]                        ^
    [javac] 31 errors

BUILD FAILED
/Users/user/.adt/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/user/.adt/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 2 seconds

]

I installed the latest Android versions and the Google Play services.

bildschirmfoto 2013-10-08 um 18 45 29

bildschirmfoto 2013-10-08 um 18 45 05

Can anyone help setting up this project?
Thanks!

Credit the original contributors

This was originally the work of Brett @goya and included contributions by Becky @becka11y , and others. When porting to a new repo, original contributors should be noted, especially when it is not a simple fork.

Can any web elements like div's sit on top of the mapview?

I'm wondering where the mapview is in the z-index, and if it's possible to have any web elements like divs and spans overlayed on top of the map. I know it is possible to show and hide the map, but I am trying to overlay some dynamic text and animation on top of that view. Anyone know if this is possible?

need some help getting setup

Hi, am still trying to get this working on iOS. When installing with plugman i was just returning "error". So i tried using the 3.0 CLI as suggested in a different thread, which seems to install the MapKit plugin ok, but i cant execute any of the MapKit js code from the app. Here are my steps exactly from step dot. please can you let me know what i am doing wrong.

  • install cordova:
    npm install -g cordova
  • create new cordova project:
    phonegap create hello com.example.hello HelloWorld
  • go into app folder:
    cd hello
  • add and build iOS version
    phonegap build ios
  • add any core plugins i need (ie console logger):
    phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
  • add MapKit plugin:
    phonegap local plugin add https://github.com/imhotep/MapKit.git
  • edit www/js/index.js
  • rebuild
    phonegap build ios
  • open project in xcode, and compile app to device...

so, the app launches but don't see the map. even when i remove the sample code and just try and console.log(MapKit); i get nothing returned.

it doesnt look like the MapKit.js code is getting compiled into cordova_plugins.js on build. is it meant to, or should i reference the MapKit.js file in my html? i see that upon build it creates the file platforms/ios/www/js/MapKit.js, but when i just try to reference that in the html, the logger in xcode gives me this

2013-09-13 22:28:54.190 HelloWorld[6416:c07] -[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0xaa699b0
2013-09-13 22:28:54.191 HelloWorld[6416:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0xaa699b0'
*** First throw call stack:
(0x103012 0x2978e7e 0x18e4bd 0xf2bbc 0xf294e 0x3b05b 0x196c3 0x18efb 0x18a6d 0x18bf6 0x18b23 0x298c6b0 0x149e765 0x86f3f 0x8696f 0xa9734 0xa8f44 0xa8e1b 0x37a97e3 0x37a9668 0x33effc 0x1f72c 0x1f68d 0x1)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

is there perhaps anything i need to put into the global config.xml to make it work?

thanks so much for your help :)

Update documentation

The docs seem rather outdated. It seems to be lacking mentions of:

  • how to install the plugin. (cordova plugin add com.phonegap.plugins.mapkit)
  • how to load the JS. (<script src="js/MapKit.js">)

Also, the examples use plugin.mapKit when it should be just plain mapKit.

Get pins from MySQL

Hi,
How to get pins from MySQL database in cloud server with PHP?

[LOCAL] - jQuery
var pins = $.get('http://123.456.78.9/pins.php'); // It doesn't work.

[REMOTE] - PHP
echo "[{ lat: -23.561518, lon: -46.656009, title: "A Cool Title, with no Snippet", snippet: "Awesome Snippet", icon: { type: "asset", resource: "http://cache.filehippo.com/img/ex/2171__ChromeNew_icon.png", pinColor: mapKit.iconColors.HUE_VIOLET } }]"; // For example, I am not getting from database.

Thanks!

Android Backbutton

Hello,

on Android, when the map is shown the back button close the app instead of fire cordova "backbutton" event.

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.