Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'waypoint_name' to Directions API #824

Closed
danesfeder opened this issue May 22, 2018 · 9 comments · Fixed by #831
Closed

Add 'waypoint_name' to Directions API #824

danesfeder opened this issue May 22, 2018 · 9 comments · Fixed by #831

Comments

@danesfeder
Copy link
Contributor

A waypoint_name parameter was added to the Directions API to allow for custom arrival instructions that provide the destination name.

Ref: https://www.mapbox.com/api-documentation/#retrieve-directions

@osana osana added this to Maps, Nav, Search backlog in Mapbox Java Planning May 23, 2018
@osana osana moved this from Maps, Nav, Search backlog to In progress in Mapbox Java Planning Jun 7, 2018
@osana osana moved this from In progress to Waiting for Review in Mapbox Java Planning Jun 7, 2018
Mapbox Java Planning automation moved this from Waiting for Review to Done & Unreleased Jun 13, 2018
@wbearand
Copy link

Do I understand correctly that adding waypoint_names to MapMatching requests as mentioned here:
https://www.mapbox.com/api-documentation/#retrieve-a-match
will be possible once this feature request is moved to released? If so when will this approximately happen?

@wbearand
Copy link

I realised there is .addWaypointNames() now available on MapboxMapMatching.builder with
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:3.3.0-SNAPSHOT'

Unfortunately i get a native crash when using:
.waypoints(new Integer[]{0, pointArrayList.size()-1})
.addWaypointNames(new String[]{"Testtext one", "Testtext two"})

06-18 11:36:56.645 11302-11302/com.................................. A/libc: /usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed
Fatal signal 6 (SIGABRT), code -6 in tid 11302 (...............)
06-18 11:36:56.728 11391-11391/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/shamu/shamu:7.1.1/N6F27M/4299435:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 11302, tid: 11302, name: ............... >>> com.................................. <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
06-18 11:36:56.738 11391-11391/? A/DEBUG: Abort message: '/usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed'
r0 00000000 r1 00002c26 r2 00000006 r3 00000008
r4 ab8e158c r5 00000006 r6 ab8e1534 r7 0000010c
r8 00000000 r9 bec42ad8 sl bec42b10 fp 8d468780
ip 0000000b sp bec42508 lr aa77f5c7 pc aa781e30 cpsr 600f0010
06-18 11:36:57.114 11391-11391/? A/DEBUG: backtrace:
#00 pc 00049e30 /system/lib/libc.so (tgkill+12)
#1 pc 000475c3 /system/lib/libc.so (pthread_kill+34)
#2 pc 0001d635 /system/lib/libc.so (raise+10)
#3 pc 00019181 /system/lib/libc.so (__libc_android_abort+34)
#4 pc 00017048 /system/lib/libc.so (abort+4)
#5 pc 0001b633 /system/lib/libc.so (__libc_fatal+22)
#6 pc 0001937b /system/lib/libc.so (__assert2+18)
#7 pc 00366f8f /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#8 pc 0036707b /data/app/com..................................-1/lib/arm/libmapbox-gl.so
06-18 11:36:57.115 11391-11391/? A/DEBUG: #9 pc 0036544d /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#10 pc 00364ebd /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#11 pc 0003e52b /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#12 pc 00048dad /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#13 pc 0018858d /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#14 pc 001a70db /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#15 pc 001a892f /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#16 pc 000a0c1d /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#17 pc 00185dc5 /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#18 pc 00185eef /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#19 pc 00281467 /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#20 pc 00280c07 /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#21 pc 00280401 /data/app/com..................................-1/lib/arm/libmapbox-gl.so
#22 pc 00011e73 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+614)
#23 pc 00011b7f /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
#24 pc 00093811 /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
#25 pc 01bb0a55 /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.nativePollOnce+96)
#26 pc 01bb1f69 /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.next+188)
#27 pc 01bad7db /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.Looper.loop+366)
#28 pc 016112ff /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.app.ActivityThread.main+426)
#29 pc 000a9941 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
#30 pc 00405d91 /system/lib/libart.so (art_quick_invoke_static_stub+228)
#31 pc 000b0c1b /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
#32 pc 00316333 /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
#33 pc 003176a7 /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+766)
#34 pc 002be5f1 /system/lib/libart.so (ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3+40)
#35 pc 005adbc9 /system/framework/arm/boot.oat (offset 0x51a000) (java.lang.reflect.Method.invoke+116)
06-18 11:36:57.116 11391-11391/? A/DEBUG: #36 pc 020a04a1 /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
#37 pc 020a1327 /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit.main+1218)
#38 pc 000a9941 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
#39 pc 00405d91 /system/lib/libart.so (art_quick_invoke_static_stub+228)
#40 pc 000b0c1b /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
#41 pc 00316333 /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
#42 pc 00316143 /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+266)
#43 pc 00278b37 /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+426)
#44 pc 00067d91 /system/lib/libandroid_runtime.so
#45 pc 0006965f /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+498)
#46 pc 00001945 /system/bin/app_process32
#47 pc 00016c61 /system/lib/libc.so (__libc_init+48)
#48 pc 00001564 /system/bin/app_process32

@danesfeder
Copy link
Contributor Author

@wbearand At what point are you seeing this crash? After the route has been passed to the UI?

@wbearand
Copy link

Timber.d("drawMapMatched - before mapMatching builder");
MapboxMapMatching client = MapboxMapMatching.builder()
.accessToken(Mapbox.getAccessToken())
.profile(PROFILE_DRIVING)
.coordinates(pointArrayList)
.language(Locale.ENGLISH)
.voiceUnits(IMPERIAL)
.steps(true)
.voiceInstructions(true)
.bannerInstructions(true)
.waypoints(new Integer[]{0, pointArrayList.size()-1})
.addWaypointNames(new String[]{"Testtext one", "Testtext two"})
.build();
Timber.d("drawMapMatched - before client.enqueueCall");

I only get to see the first log message, not the second one:

06-18 15:51:38.042 24618-24618/com.................................. D/CustomMapFragment: drawMapMatched - before mapMatching builder

        --------- beginning of crash
    06-18 15:51:38.048 24618-24618/com.................................. A/libc: /usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed
    06-18 15:51:38.049 24618-24618/com.................................. A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 24618 (...............)
    06-18 15:51:38.128 24736-24736/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        Build fingerprint: 'google/shamu/shamu:7.1.1/N6F27M/4299435:user/release-keys'
        Revision: '0'
        ABI: 'arm'
        pid: 24618, tid: 24618, name: ...............  >>> com.................................. <<<
        signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    06-18 15:51:38.135 24736-24736/? A/DEBUG: Abort message: '/usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed'
            r0 00000000  r1 0000602a  r2 00000006  r3 00000008
            r4 ab8e158c  r5 00000006  r6 ab8e1534  r7 0000010c
            r8 00000000  r9 bec42ad8  sl bec42b10  fp 8d237600
            ip 0000000b  sp bec42508  lr aa77f5c7  pc aa781e30  cpsr 600f0010
    06-18 15:51:38.496 24736-24736/? A/DEBUG: backtrace:
            #00 pc 00049e30  /system/lib/libc.so (tgkill+12)
    06-18 15:51:38.497 24736-24736/? A/DEBUG:     #01 pc 000475c3  /system/lib/libc.so (pthread_kill+34)
            #02 pc 0001d635  /system/lib/libc.so (raise+10)
            #03 pc 00019181  /system/lib/libc.so (__libc_android_abort+34)
            #04 pc 00017048  /system/lib/libc.so (abort+4)
            #05 pc 0001b633  /system/lib/libc.so (__libc_fatal+22)
            #06 pc 0001937b  /system/lib/libc.so (__assert2+18)
            #07 pc 00366f8f  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #08 pc 0036707b  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #09 pc 0036544d  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #10 pc 00364ebd  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #11 pc 0003e52b  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #12 pc 00048dad  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #13 pc 0018858d  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #14 pc 001a70db  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #15 pc 001a892f  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #16 pc 000a0c1d  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #17 pc 00185dc5  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #18 pc 00185eef  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #19 pc 00281467  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #20 pc 00280c07  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #21 pc 00280401  /data/app/com..................................-2/lib/arm/libmapbox-gl.so
            #22 pc 00011e73  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+614)
    06-18 15:51:38.498 24736-24736/? A/DEBUG:     #23 pc 00011b7f  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
            #24 pc 00093811  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
            #25 pc 01bb0a55  /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.nativePollOnce+96)
            #26 pc 01bb1f69  /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.next+188)
            #27 pc 01bad7db  /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.Looper.loop+366)
            #28 pc 016112ff  /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.app.ActivityThread.main+426)
            #29 pc 000a9941  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
            #30 pc 00405d91  /system/lib/libart.so (art_quick_invoke_static_stub+228)
            #31 pc 000b0c1b  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
            #32 pc 00316333  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
            #33 pc 003176a7  /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+766)
            #34 pc 002be5f1  /system/lib/libart.so (_ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3_+40)
            #35 pc 005adbc9  /system/framework/arm/boot.oat (offset 0x51a000) (java.lang.reflect.Method.invoke+116)
            #36 pc 020a04a1  /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
            #37 pc 020a1327  /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit.main+1218)
            #38 pc 000a9941  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
            #39 pc 00405d91  /system/lib/libart.so (art_quick_invoke_static_stub+228)
            #40 pc 000b0c1b  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
            #41 pc 00316333  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
            #42 pc 00316143  /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+266)
            #43 pc 00278b37  /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+426)
    06-18 15:51:38.499 24736-24736/? A/DEBUG:     #44 pc 00067d91  /system/lib/libandroid_runtime.so
            #45 pc 0006965f  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+498)
            #46 pc 00001945  /system/bin/app_process32
            #47 pc 00016c61  /system/lib/libc.so (__libc_init+48)
            #48 pc 00001564  /system/bin/app_process32

@wbearand
Copy link

if i remove
.addWaypointNames(new String[]{"Testtext one", "Testtext two"})
everything works again as expected.

@osana
Copy link
Contributor

osana commented Jun 20, 2018

@wbearand could you provide your pointArray values so that I could try to reproduce it.

@osana
Copy link
Contributor

osana commented Jun 20, 2018

@wbearand Could you also try: .addWaypointNames("Testtext one", "Testtext two")

@osana
Copy link
Contributor

osana commented Jun 20, 2018

@wbearand

I just tried the following code:

List pointArrayList = Arrays.asList(
Point.fromLngLat(-117.1728265285492,32.71204416018209),
Point.fromLngLat(-117.17292040586472,32.71256999376694),
Point.fromLngLat(-117.17334151268004,32.71254065549407));

MapboxMapMatching mapMatching = MapboxMapMatching.builder()
  .accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
  .profile(PROFILE_DRIVING)
  .coordinates(pointArrayList)
  .language(Locale.ENGLISH)
  .voiceUnits(IMPERIAL)
  .steps(true)
  .voiceInstructions(true)
  .bannerInstructions(true)
  .waypoints(new Integer[]{0, pointArrayList.size()-1})
  .addWaypointNames(new String[]{"Testtext one", "Testtext two"})
  .build();

in the samples of mapbox-java and ti runs fine.

If there is only one point in the pointArrayList then
com.mapbox.core.exceptions.ServicesException: At least two coordinates must be provided with your API request. will be thrown

@wbearand
Copy link

hi @osana , thanks for testing. I actually can't reproduce it anymore, it works now both ways.

@lilykaiser lilykaiser removed this from Done & Unreleased in Mapbox Java Planning Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants