1.1.8 • Published 6 years ago

cordova-plugin-navitia-sdk-ux v1.1.8

Weekly downloads
6
License
GPL-3.0
Repository
github
Last release
6 years ago

NavitiaSDK UX for Cordova

Cordova plugin for using NavitiaSDK UX

Installation

This plugin uses Carthage to build dependencies for iOS, please install it first: https://github.com/Carthage/Carthage

Then use this command to install the plugin

cordova plugin add cordova-plugin-navitia-sdk-ux

Setup for Android platform

This plugin uses Google Maps and requires a Google API key in case you're targeting the Android platform with your cordova application. You can get your own API key using this link: https://developers.google.com/maps/documentation/android-api/signup

You need to update your config.xml file as follows:

<widget ......... xmlns:android="http://schemas.android.com/apk/res/android">
    .
    .
    <platform name="android">
        .
        .
        <config-file parent="/manifest/application" target="AndroidManifest.xml">
            <meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_API_KEY" />
        </config-file>
    </platform>
    .
    .
</widget>

Note that you have to change YOUR_API_KEY with your own API key!

Usage

NavitiaSDKUX.init(config, success, failure)

ParametersTypeRequiredDescriptionExample
configObjectConfiguration
config.tokenStringToken navitia0de19ce5-e0eb-4524-a074-bda3c6894c19
successFunctionSuccess callback functionfunction() {}
failureFunctionFailure callback functionfunction(error) {}

NavitiaSDKUX.invokeJourneyResults(params, success, failure)

ParametersTypeRequiredDescriptionExample
paramsObjectParameters of the screen
params.originIdStringOrigin coordinates, following the format lon;lat2.3665844;48.8465337
params.destinationIdStringDestination coordinates, following the format lon;lat2.2979169;48.8848719
params.originLabelStringOrigin label, if not set the address will be displayedHome
params.destinationLabelStringDestination label, if not set the address will be displayedWork
params.datetimeDateRequested date and time for journey resultsnew Date()
params.datetimeRepresentsNavitiaSDKUX.DatetimeRepresentsCan be NavitiaSDKUX.DatetimeRepresents.DEPARTURE (journeys after datetime) or NavitiaSDKUX.DatetimeRepresents.ARRIVAL (journeys before datetime).NavitiaSDKUX.DatetimeRepresents.DEPARTURE
params.forbiddenUrisStringList of navitia uris'commercial_mode:Bus', 'line:1'
params.firstSectionModesNavitiaSDKUX.SectionModeList of modes to use at the begining of the journeyNavitiaSDKUX.SectionMode.CAR
params.lastSectionModesNavitiaSDKUX.SectionModeList of modes to use at the end of the journeyNavitiaSDKUX.SectionMode.BIKE, NavitiaSDKUX.SectionMode.BSS
params.countIntegerThe number of journeys that will be displayed3
params.minNbJourneysIntegerThe minimum number of journeys that will be displayed3
params.maxNbJourneysIntegerThe maximum number of journeys that will be displayed10
successFunctionSuccess callback functionfunction() {}
failureFunctionFailure callback functionfunction(error) {}

Example

var config = {
    token: 'my-token',
};

NavitiaSDKUX.init(config, function() {}, function(error) {
    console.log(error);
});

var journeyParams = {
    originLabel: 'My Home',
    originId: '2.3665844;48.8465337',
    destinationId: '2.2979169;48.8848719',
};

NavitiaSDKUX.invokeJourneyResults(journeyParams, function() {}, function(error) {
    console.log(error);
});

Known issues

  • Color configuration not available yet (but soon!)

Troubleshooting

Specific android tools version : 26

In case you are having problems building and getting this kind of problems :

platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name ...

You may try to override your android compiler environment variables :

export ORG_GRADLE_PROJECT_cdvCompileSdkVersion=android-26
export ORG_GRADLE_PROJECT_cdvBuildToolsVersion=26.0.1

More information on Cordova website

Manifest merger issue

This usually happens if you change the API key in the config.xml file. The build fails and you're getting this kind of error:

Element meta-data#com.google.android.geo.API_KEY at AndroidManifest.xml:xx:xx-xx duplicated with element declared at AndroidManifest.xml:xx:xx-xx

You may try to remove the Android platform and add it back again.

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago