osmandapp / osmand-api-demo

Example of usage OsmAnd API
87 stars 43 forks source link

OSMAND crash when running api-demo #76

Open fre391 opened 5 months ago

fre391 commented 5 months ago

TARGET:

I would like to get information from Osmand as soon as a nav update is triggered.

IMPLEMENTATION:

  1. So the idea was to change the ApiActionType in MainActivity to: ApiActionType.AIDL_REGISTER_FOR_NAV_UPDATES -> { aidlHelper.setNavigationInfoUpdateListener(object : OsmAndAidlHelper.NavigationInfoUpdateListener { override fun onNavigationInfoUpdate(directionInfo: ADirectionInfo?) { runOnUiThread { val text = "NavigationInfoUpdate" Toast.makeText(this@MainActivity, text, Toast.LENGTH_SHORT).show() mOsmAndHelper!!.getInfo() } } }) callbackKeys[KEY_NAV_INFO_LISTENER] = aidlHelper.registerForNavigationUpdates(true, 0) }

  2. And for testing purpose modify the onActivityResult to //showOsmandInfoDialog(sb.toString()) Toast.makeText(this@MainActivity, sb.toString(), Toast.LENGTH_SHORT).show()

  3. Rest of the demo api remains the same, except
    private static final String OSMAND_PACKAGE_NAME = OSMAND_FREE_PACKAGE_NAME;

RESULT:

If the demo app is started it first works as expected, but after a while (sometimes after minutes) a crash in OSMAND appears. Please refer to the exception.log I send per email. Device : r8q Brand : samsung Manufacturer : samsung Model : SM-G781B Product : r8qxeea Build : TP1A.220624.014.G781BXXS9HXA6 Version : 13 App Version : OsmAnd Apk Version : 4.7.7 4707

Hope to get your feedback on this soon...As I also have started a more complex open community app at https://github.com/fre391/OsmAndHud (UNDER DEVELOPMENT!) , which also leads into the same error after a while....

Good luck and thank you very much for this nice piece of software....

Markus