First of all, I have zero knowledge in Java. Years of experience in Visual Basic helped me develop couple of Android apps, without much sweating, using the amazing B4A. So what I am about to say might be completely wrong and foolish. Please bear with me.
Since 2010, Android's popularity is on the rise. This has led to certain service provider sites (advertisement networks, analytic providers etc..) release a dedicated Android SDK of their service, which can be integrated into our Android projects. They usually provide a JAR file and some sample code as well which can be used. For example, here is Google Analytics SDK for Android:
Google Analytics SDK for Android - Google Analytics for Mobile - Google Code
In the above page, they are providing the Analytics SDK JAR file as well as the sample code that can be used to access it. Unfortunately, since the above code is in Java, we cannot use it directly in B4A. Normally we need a B4A wrapper library for these SDKs but we cannot expect the Java developers here to come up with libraries for each and every SDKs available. Of course we have the Reflection library but I am not sure if it can be used to execute such blocks of code.
Now if my understanding is correct, B4A actually converts the code to Java first and then compiles the APK file. If that is the case, I was wondering if it will be possible for B4A to take the Java code like the sample code on Analytics SDK page, and send it directly to compiler.
One of the first doubts will be where to put this Java code in our project in such a way that the B4A compiler, which expects B4A code, will not come up with syntax errors. Currently we have 3 types of modules - Activity, Service and Code. I was wondering if we could have a 4th module called Java module where we can put the Java code directly, may be inside Subs or Functions which we can call from B4A.
I know this isn't as easy as I make it out to be. In fact this may be a completely stupid idea. Still I am curious about the possibilities.
Since 2010, Android's popularity is on the rise. This has led to certain service provider sites (advertisement networks, analytic providers etc..) release a dedicated Android SDK of their service, which can be integrated into our Android projects. They usually provide a JAR file and some sample code as well which can be used. For example, here is Google Analytics SDK for Android:
Google Analytics SDK for Android - Google Analytics for Mobile - Google Code
In the above page, they are providing the Analytics SDK JAR file as well as the sample code that can be used to access it. Unfortunately, since the above code is in Java, we cannot use it directly in B4A. Normally we need a B4A wrapper library for these SDKs but we cannot expect the Java developers here to come up with libraries for each and every SDKs available. Of course we have the Reflection library but I am not sure if it can be used to execute such blocks of code.
Now if my understanding is correct, B4A actually converts the code to Java first and then compiles the APK file. If that is the case, I was wondering if it will be possible for B4A to take the Java code like the sample code on Analytics SDK page, and send it directly to compiler.
One of the first doubts will be where to put this Java code in our project in such a way that the B4A compiler, which expects B4A code, will not come up with syntax errors. Currently we have 3 types of modules - Activity, Service and Code. I was wondering if we could have a 4th module called Java module where we can put the Java code directly, may be inside Subs or Functions which we can call from B4A.
I know this isn't as easy as I make it out to be. In fact this may be a completely stupid idea. Still I am curious about the possibilities.