Isn't it cool when it comes true? However, the ultralite.NET api seems only works on windows (desktop or mobile). So I have spent quite some time on building a POC of this and what I have achieved so far:
Although I am blocked currently, I believe so far that this approach should be doable. However what confused me is: the API exposed by
Bellow is the details of what I have done and encountered: NOTE:
Attempting native Android stacktrace: at ???+0 [0xe0830fe8] at ???+0 [0xe0cc0578] Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. Fatal signal 11 (SIGSEGV), code 2, fault addr 0xdda301a1 in tid 7285 (tralite_android) |
Hi, There is actually support from Xamarin for the SAP Mobile SDK. http://scn.sap.com/community/mobile/blog/2014/03/04/xamarin-sap https://blog.xamarin.com/sap-mobile-enterprise-webinar/ https://www.xamarin.com/sap D. I wouldn't accept this answer, because Xamarin announced the support of OData web services. This is not what the author requires.
(12 May '16, 03:34)
Vlad
@ddeconin, thanks for pointing out. I went through the webinar at https://xamarin.wistia.com/medias/xcak8ronxu. It did mentioned a "SAP Mobile .NET SDK" and interesting enough it was developed by Xamarin. However, it seems to me the SDK did not provide offline support (this feature was in its road map) which is to say it probably did not integrate with Ultralite at that time, correct me if I am wrong. Now when I search this SDK at https://components.xamarin.com/, I dont' find it! Something must had happened after the webinar, I guess. Having said all these, since your answer is not directly related to the question, I am afraid I cannot accept it. Thanks anyway.
(12 May '16, 03:42)
riverlei
|
I've got a Xamarin binding which wraps the Android UltraLiteJNI12.jar - it's one of the first things I did in Xamarin several years ago! I'm not sure whether this exposes all the features you want (I'm rather out of the loop regarding Ultralite these days). Would this help? James @James Lavery, the approach you taken definitely works for Anroid but for IOS another wrapper is required which is not I want. Thanks anyway. Lei He
(13 May '16, 01:48)
riverlei
|
You are unlikely to get this to work with the licensed components offered. UltraLite.NET consists of managed and unmanaged code. Even if you were permitted to decompile the managed code (please review your license agreement), there is no unmanaged code available for the Android platform. We do provide a native library for UltraLIteJ on Android but that library is not compatible with UltraLite.NET. And neither the unmanaged code nor the Android native library expose an API that is compatible with the C/C++ API. Those native code components expose the APIs consistent with their parent technology.
It seems that it is better to build a custom layer around .NET and Android libraries. I have googled a little bit, and see that bindings can be written (https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/). To be honest, I do not like even this approach, because it is so time consuming and clumsy (especially because, as Chris said, APIs are not compatible).
Hello, Chris Glad to hear from you here! I am from SMP enginering of SAP and we had quite a few emails regarding SQLAnywhere performance tuning when I was doing customer sustaining for SMP 2.x of SAP, if you remember. I came across a link in this forum which says "although Android uses the UltraLiteJ API, it actually uses the underlying UltraLite C runtime so the database and SQL supported are identical to the iPhone." I believe it is still true at this time. Although the same link also says "I wish I could say one data access works for all but due to the different development environments (Objective C for iPhone, Java for BlackBerry and Android), one code base isn't going to do it." but it is almost half a decade ago and Xamarin is not around yet. With Xamarin, the development environments are C# for IOS and C# for Android. This is a big leap toward one code base for all IMO. I'd like to refine my questions to: Is it feasible to have a unified C# API across IOS, Andoird (let's put away Windows for a while) based on the same Ultralite C runtime? If the answer is yes, how much effort would it require?
By the way, here is the link I mentioned above: http://sqlanywhere-forum.sap.com/questions/7702/developing-ultralite-app-for-iphone-android-laptop?page=1&focusedAnswerId=7703#7703
Thanks and Regards Lei He
I agree with you that wrapping the existing .NET and Android libraries is clumsy although it seems possible. What I think best for now is to create a C# layer directly on the Ultralite C runtime after I came across the link I mentioned in my reply to Chris which says "although Android uses the UltraLiteJ API, it actually uses the underlying UltraLite C runtime so the database and SQL supported are identical to the iPhone". However I am not sure how to get started. What would you suggest?
Thanks and Regards
Lei He
Hi Lei He,
I do not know for sure. If we are talking about native libraries in general, I would suggest to read this link: http://www.codeproject.com/Tips/712178/Csharp-NET-Interoperability-with-Native-C-Librar This is what .NET offers from the beginning. But I do not know if this approach suits you well.
Kind regards,
Vlad
Let me reiterate that this is not feasible with current SQL Anywhere shipping software. UL.NET requires unmanaged code, a native library, which is provided only as a Windows (desktop and CE) binary. That unmanaged code calls into the UL runtime or into the UL engine (for applications that require concurrent usage by different applications) to implement the UL.NET API. That unmanaged code is not provided as an Android binary nor do we provide development components for UL C/C++ on that platform. What we do provide is a JNI shared library that is compatible with the ULj API but not with the UL.NET API.