1

We are building a navigation application using Indoor Atlas SDK which has a map on upper 30% of screen and 2 list view on lower 70% of the screen, and in order to keep the code cross platform i have created it using Xamarin Forms Portable Class Library and using Dependency Injection for Platform Specific Code.

I created a bindings library as described in this tutorial and though it was hard in the start because as soon as i load the app in emulator it crashed by throwing an Unspecified Link Error, which turned out to be because of the fact that my default emulator was on x86 architecture whereas IndoorAtlas Native libraries are present only for armabi-v7a and arm64-v8a and running app on such device didn't threw an error, but i can't make it work as in detect current location and get current floor plan, though i can make it work exactly the other way round.

To show the exact code - this doesn't works where BackgroundListener.Currentlocation is of type Android.Locations.Location

mIALocationManager = IALocationManager.Create(this);
IALocation currentLocation = IALocation.From(BackgroundListener.Currentlocation);
mIALocationManager.SetLocation(currentLocation);

but this does

string floorPlanID = "b11a5c2b-6f9b-4865-b52e-lastidpart";
IALocation FLOOR_PLAN_ID = IALocation.From(IARegion.FloorPlan(floorPlanID));
mIALocationManager.SetLocation(FLOOR_PLAN_ID);

By doesn't work i mean it is not able to detect the region which to a great extent is intuitive. I checked the docs and found this code to fetch the FloorPlan

private void fetchFloorPlan(String id) {
    // Cancel pending operation, if any
    if (mPendingAsyncResult != null && !mPendingAsyncResult.isCancelled()) {
        mPendingAsyncResult.cancel();
    }

    mPendingAsyncResult = mResourceManager.fetchFloorPlanWithId(id);
    if (mPendingAsyncResult != null) {
        mPendingAsyncResult.setCallback(new IAResultCallback<IAFloorPlan>()     {
        @Override
        public void onResult(IAResult<IAFloorPlan> result) {
            Logger.d(TAG, "onResult: %s", result);

            if (result.isSuccess()) {
                handleFloorPlanChange(result.getResult());
            } else {
                // do something with error
                Toast.makeText(FloorPlanManagerActivity.this,
                    "loading floor plan failed: " + result.getError(), Toast.LENGTH_LONG)
                    .show();
            }
        }
     }, Looper.getMainLooper()); // deliver callbacks in main thread
  }
}

Now i have spent 3 days searching for the solution, but at the time of writing the documentation of IndoorAtlas is not very detailed (or probably i am just used to the detailed kinds of MSDN). I do have a bit of a Java knowledge (since i studied it in college, but no proficiency) and this was the primary reason i switched to Xamarin. With C# being my primary language of expertise i am able to finish most of the app with Xamarin in just 3 weeks whereas i couldn't finish even half with Java in last 6 months (which rules out any suggestions for working the app in Native Android).

Now the queries are

  • fetchFloorPlan requires floorPlanID as parameter, how do i get that automatically.
  • In Java we can instantiate interface, which we can't in C# so how do i fetch the floor plan.
  • Automated JAR bindings in Xamarin creates an IATask and other interfaces (non-generic) whereas the function expects generics, i can create my own tasks but the other functions expects these inputs, so no benefit.
  • I do suspect that we can recreate all the steps in C# but i don't have that much expertise in Java
  • I also suspect that anonymous methods might have resolved such a solution if the code had been completely in C#, but i couldn't understand the way here.

So i need help and guidance in finding the path to solution.

Other points which though give the reasons as to why this issue of generics happen, i am looking for solution to it

Note : If you feel that i am being a help vampire for free help, we can connect and outsource some section of the app, as i had already posted a query on Upwork and i will anyway post the solution to community for future readers.

Community
  • 1
  • 1
Abhishek Siddhu
  • 547
  • 6
  • 20
  • 1
    The wrapper generated from JAR won't contain generics, as the Java compiler removes the generics in fact during compilation. You will have to check Xamarin documentation on how to handle that case, but it is absolutely not a bug of the wrapper generator. – Lex Li Mar 27 '16 at 11:41
  • @LexLi I didn't meant it's a bug, apologies if i sounded that way, i am asking for a solution or direction where i should be heading as i couldn't find it in the docs – Abhishek Siddhu Mar 27 '16 at 11:45
  • Thanks for the insight Lex Li on why this happens. But what, pray tell, is the solution? – Dr. Andrew Burnett-Thompson Apr 10 '16 at 17:15

0 Answers0