NativeScript / NativeScript/android

wrong native method signature called.

Open
#1,645 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
563
Forks
144
Avg merge
10h 46m
Merged PRs (30d)
14

Description

I found an issue with runtime which actually calls the wrong method on android.
this the method
https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.GpsStatus.NmeaListener)
That method changed in 24 and now use that signature https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener)
The issue is that in both cases the parameter is actually a java.lang.Object. And the runtime actually always chooses this one even on pre 24 => crash.
We discovered that issue in my gps plugin here and the actual crash happens here https://github.com/nativescript-community/gps/blob/b3fe1d032cb3e5b6f7b76f1cf62926fdab6d0baa/src/gps.android.ts#L456

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced gps.android.ts locations, especially lines 83 and 456, to reproduce how the runtime invokes LocationManager.addNmeaListener. Then trace the Android native method-selection code and verify that pre-24 and 24+ use the appropriate signatures without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.