Can I use parse4cn1 in non cn1 projects? - codenameone

I've been trying to download the parse4j from Thiagolocatelli but they're missing version 1.5-SNAPSHOT which includes a third parameter for Parse.initialize(), but I can't download version 1.5-SNAPSHOT from github nor from Maven repository, people talk about version 1.5-SNAPSHOT but looking at the Maven repository: https://mvnrepository.com/artifact/com.github.thiagolocatelli/parse4j there is no version 1.5-SNAPSHOT. So is it possible to use parse4cn1 in non cn1 projects like Android Studio projects? Will library work?

It is possible to use parse4cn1 in a regular Java project as documented here. In fact, the parse4cn1 unit test application uses this approach successfully. As already mentioned by Shai, you'll have some dependencies on some CN1-specific functionality but that is available via the CN1 JavaSE port.
For Android, I'll recommend using the native Android Parse SDK directly. The API is slightly different from that of parse4cn1 but in most cases similar. Moreover, the SDK provides more functionality such as a local data store.

No.
The code uses ConnectionRequest and similar Codename One specific classes to implement parse support.

Related

Integrating a Today Extension into a Codename One iOS App

I'm new to this topic and couldn't find any guides concerning this. I'm wondering how the Today Extension files from a xcode project (originated from the CN1 iOS debug build sources) needs to be added to the actual CN1 project in order to get integrated properly.
We don't have builtin support for that and didn't really study it. We never had official support for Android widgets either.
Both can be used through native code though. E.g. in this case you can use ios.plistInject to add the necessary plist changes. The actual UI/code that implements them should be done in a native interface anyway.

Codename one methods not available on android device

The methods that are missing from the apk file are
BorderLayout.centerEastWest()
Dialog constructor with (String, Layout) as arguments.
There are probably more but these are the ones I encountered. I can work around the problem by using alternate methods and constructor but there seems to be a mismatch between the local library and the android build library.
Please note that when building the project I had to use the android.gradle=false hint for the apk to be readable on my older android 2.3.6 device. Without this hint the apk is not accepted on the device.
In addition the theme resource file is not loaded on the device while it is in the simulator. All these problems might be related ?
Thanks for your help
New features are no longer added to the old Ant build pipeline as maintaining it has become unwieldy since Google no longer supports proper versions of play services or other features we need.
We still have it for compatibility for people who built old applications with it but it's version of the Codename one libraries is frozen in time as newer versions of the libraries will break it. Google killed support forthe 2.x device family ages ago in play services so basic things like in-app purchase or proper location API's can't work on those old devices. The problem is that supporting them would make support for newer features MUCH harder.
I've edited the docs to reflect that this flag is deprecated.

Run native C++ code on codename one

I have an android app where I am running native C++ code using JNI (Java Native Interface). I want to port it to codename one so that it can run on iOS as well. What is the alternative to JNI on codename one that will allow me to run my native C++ code?
You can call C++ from Objective-C we did just that in the ZXing demo for the iOS port see: http://github.com/codenameone/codenameone-demos
For Android you will need to wrap the C++ code using the NDK in order to use it. Chen discussed this a while back in a blog post here: http://www.codenameone.com/blog/integrating-android-3rd-party-libraries-jni.html
The relevant section is this:
We recently added a 3rd option :aar files. The aar file is a binary format from Google that represents an Android Library project.
One of the problem with the Android Library projects was the fact that
it required the project sources which made it difficult for 3rd party
vendors to publish libraries, so android introduced the aar file which
is a binary format that represents a Library project.
To learn more about arr you can read this.
You can link an aar file by placing it under the native/android and
the build server will link it to the project.
Notice that for Android you might want to use the new gradle build system which would also make this simpler: http://www.codenameone.com/blog/material-icons-background-music-geofencing-gradle.html
Codenameone has it's native interface that allows adding native codes.
Each platform has it's native code and as far as I know C++ is not in any of them.
I would suggest you translate your code from C++ to Java and Objective-C manually and you can use those code in implementing CN1 native interface.
Read about Native Interface here and also have a look at native demo

Using IDTech UniPay Card Reader with Cordova/PhoneGap

After installing this plugin: https://github.com/TranWare/cordova-plugins which should work with this device: http://www.idtechproducts.com/products/mobile-readers/176.html
I am trying to use it but when I called it "IDTech is not defined" even I saw the plugin running on debug mode!
Are you developing for Android or iOS (or both)?
Looking at the source of this plugin, its Android only. Unfortunately, it looks like nobody has written a proper Cordova plugin for the IDTech card reader that supports both platforms :(
I did find another plugin, but this one is iOS only: https://github.com/deboorn/iMag-Cordova-Plugin. Maybe give that one a shot instead?
I should note I've not tried either of these plugins personally, but I am doing some research in adding support for this device in a Cordova app I've built and came across that plugin (and your post). Best of luck!

How do I get Codenameone 2.0 from my IDE?

I understand Codenameone 2.0 has been released. When I updated the plugin from my IDE, the plugin version on Netbeans says it is version 1.0.68? Is this the 2.0?
The plugin version has nothing to do with the version of Codename One.
Codename One versions are mostly a code stabilization milestone that can then be used in versioned builds. Since Codename One is a cloud service you are effectively always using the latest version of Codename one unless you explicitly use a versioned build.

Resources