Can can tell me how to use the ZXing library in an android app in TITANIUM.I have downloaded the ZXing library from the following path : http://code.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip
Creating a custom module is the only way to do this. Therefore you have to have knowledge of the native platform.
Modules are not too difficult if you have native platform experience (or just know Java for Android). I would check the moddevguide example module which is chock full of examples of passing data back and forth, which is available in the public Titanium repository on github. Also, the paint module is a great example of subclassing to roll your own titanium component.
So first go here and follow these step-by-step instructions on how to start your own module. Documentation Link
Then check out this code for great examples of passing data throughout your app. Titanium Github
All that aside, if you dont have native platform experience, why not just use either the Titanium Plus modules barcode scanner? Or this open source alternative?
No need to reinvent the wheel at this point.
Related
What i want to achieve is something like creating my own SDK like what react-native-fbsdk or rn-onesignal-sdk provides , so that those functionalities can be implemented in the react native project.
Basic questions :
Where to start from? Like what are the pre-requisites?
Native coding is required i believe for this functionality?
Any explanation or any such experience in such would be of great help .
Where to start from? Like what are the pre-requisites?
You can use a template like this one. It includes an example project which is basically an app that you can use to test integration of your native module and to quickly iterate on it.
Native coding is required i believe for this functionality?
Only if you need to use platform-specific functionality, or provide bindings to some pre-existing native library. Both examples you mentioned do exactly that – because they have native SDKs that can be used in non-RN apps, and they provide React Native bindings for them.
If your library is just business logic + some networking, and you don't intend it to be used in non-RN apps, you can do it all in JS. No need for native code. If you choose to go with the template that I have linked above, there are instructions how to use it to create a pure JS React Native library.
I'll be happy to update my answer if you can share some concrete requirements of what you want your SDK to do.
I'm trying to understand what structure should have a multiplatform library. Checking on the Internet I've seen a huge number of examples explaining how to make a log or a "hello world" but there's a lack of complex examples, even in the official documentation (important to note that I'm only interested in mobile platform, iOS and Android).
So I want to create an example that simply opens the camera (as a lib, not as a multiplatform app) just to have an idea of how to work with a real feature which, also, is native. Right now I have created a project following the official example, so it has a common module (using expect) and one for Android and one for iOS (using actual), and now these are my doubts:
I've seen that the iOS module is also in Kotlin, Kotlin/Native as I understand. Should my project have also an wrapper in Swift, or will the library have no Swift code? And if it should, where should it be in the project structure?
Also in the Android module I've noticed I cannot import the class "Activity" nor the "Intent", which I will need to open the camera, why? is this code restricted to Java without the Android libs? Should it also have a wrapper to Android? If so, how can I configure this wrappers?
I know I can use the "expect" key when creating classes but, as I understand, the common and the native modules will always be separated classes. I mean, if I create a class in the common module, can I define methods of this class using "expect" and define them later in the native?
Can my lib have a Manifest?
Finally, does anyone knows a real example that really explain a more complex situation?
Thanks
Okay, let's go through your questions one-by-one.
I would recommend you to have a look at this example
The
iOS module produces an Objective-C framework as a result. It can be utilized by the Xcode project the same way as any other framework with non-Kotlin origins.
It looks like the unavailability to use
Android SDK is the result of using jvm("android") target instead
of android() one. To use the android target, one has to apply the android Gradle plugin in addition to kotlin-multiplatform one.
I
think you want to do something like that: just ordinary class
declaration in the common and extension function for it with an
expect modifier. And then actualize it in the platform-specific
code.
I think so.
I'd also recommend you to have a look at
this and this, maybe these examples will be complex enough for you.😁
Is there any (easy) way to link to native libraries, specifically OpenCV, using Telerik NativeScript? I suppose since it outputs source I could go into the Android and ios projects after compiling and implement all of the openCV code seperately, but that sort of defeats the purpose of using NativeScript, imo.
Is there any cross-platform way to interface with native code?
Thanks!
If OpenCV supports Android and iOS then you would need to create the communication to the native code to use it. That's how all of NativeScript works, it allows you to use Javascript (TypeScript) and communicate directly to native code without any wrappers.
So essentially everything in NativeScript has a wrapper to the underlying native code/components, that's the difference and the power behind products like NativeScript and React Native as opposed to Cordova based apps (PhoneGap, Ionic, etc.).
Since your question isn't a code specific question, it's kind of hard to answer and there might be a slight misinterpretation on my part of what you are really trying to understand. Hope this helps in some way. :)
here is iOS pack for openCV:
https://sourceforge.net/projects/opencvlibrary/files/opencv-ios/3.4.3/opencv-3.4.3-ios-framework.zip/download
and for android you can download it from here:
https://sourceforge.net/projects/opencvlibrary/files/opencv-android/3.4.3/opencv-3.4.3-android-sdk.zip/download
EDITED:
a solution is to write a plugin and reference the OpenCV framework using cocoapods
here is the link of how to write a plugin in native script by cocoapods
NativeScriptUsingCocoapods
I need to create an API library for Android and iOS. I have experience working with Android projects, but zero experties in iOS. I was wondering if I could create a Project library in Xamarin that compiles as a JAR for Android and as an... I-don't-know-which-type for iOS.
No, that isn't possible. Depending on what you are trying to accomplish there may be alternatives. If you are trying to make a library that can be used by others you could make it a Xamarin component - there is a component store you could put it on if you want it to be generally available, otherwise you can use any normal means of source or object distribution.
If you need to interact with a native app/library then you could make the C# code the "owner" of it and have it call into the native code. This works for both IOs and Android (and is used to work with e.g the play services from google).
No, it is unfortunately not possible to do that.
It seems to me that what you need is a Portable Class Library also known as PCL. It allows you to create a project which can be referenced by all Xamarin supported platforms (such as iOs and Android). There are obviously limitations to the approach like not being able to reference platform specific libraries but in your case (of writing an API) it should suffice.
You can read more in this link
Good Luck!
I am currently starting a project which I would like to develop both a Android and desktop app for using mono for android. I would like to encapsulate the common logic into a shared library but at the moment I am unsure of how to accomidate both frameworks.
Thanks!
You must create projects using the "Android Class Library" project template because the mscorlib supported by monodroid(v2.0.5.0) is lower then the MSFX2.0 (v2.0.50727)
You'll want to create separate class library projects for each platform, and then share the source files across them. This question has a lot of links and details about how to go about doing that.