It may be possible if any library expose a getVersion method which give the version back. But i did not saw any lib so far which does this.
All my libs does not expose such a method (getter) too.
for example: this is the xml from the youtube library.
See the last lines...
<?xml version="1.0" encoding="UTF-8"?>
<root>
<doclet-version-NOT-library-version>1.02</doclet-version-NOT-library-version>
<class>
<name>anywheresoftware.b4a.objects.YouTubeStandalonePlayerWrapper</name>
<shortname>YouTubeStandalonePlayer</shortname>
<owner>activity</owner>
<event>Result (Message As String)</event>
<permission>android.permission.INTERNET</permission>
<method>
<name>Initialize</name>
<comment>Initializes the object and sets the sub that will handle the events.</comment>
<returntype>void</returntype>
<parameter>
<name>EventName</name>
<type>java.lang.String</type>
</parameter>
</method>
<method>
<name>CheckPlayerSupported</name>
<comment>Tests whether the YouTube player service is supported.
Returns SUCCESS or an error message.</comment>
<returntype>java.lang.String</returntype>
</method>
<method>
<name>StartPlaylist</name>
<comment>Plays the videos in the playlist.
DeveloperKey - The developer key from Google APIs console.
PlaylistId - YouTube playlist id (the list value in the URL).
StartIndex - The index of the video to be played first. The first index is 0.
TimeMillis - The time in milliseconds where playback should start in the first video.
AutoPlay - Whether the playback should start automatically.
LightboxMode - If true then the video is played in a dialog over the current activity,
otherwise the video is played in its own activity (forced to landscape orientation).</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>DeveloperKey</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>PlaylistId</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>StartIndex</name>
<type>int</type>
</parameter>
<parameter>
<name>TimeMillis</name>
<type>int</type>
</parameter>
<parameter>
<name>AutoPlay</name>
<type>boolean</type>
</parameter>
<parameter>
<name>LightboxMode</name>
<type>boolean</type>
</parameter>
</method>
<method>
<name>StartVideo</name>
<comment>Plays the video.
DeveloperKey - The developer key from Google APIs console.
VideoId - YouTube video id.
TimeMillis - The time in milliseconds where playback should star.
AutoPlay - Whether the playback should start automatically.
LightboxMode - If true then the video is played in a dialog over the current activity,
otherwise the video is played in its own activity (forced to landscape orientation).</comment>
<returntype>void</returntype>
<parameter>
<name>ba</name>
<type>anywheresoftware.b4a.BA</type>
</parameter>
<parameter>
<name>DeveloperKey</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>VideoId</name>
<type>java.lang.String</type>
</parameter>
<parameter>
<name>TimeMillis</name>
<type>int</type>
</parameter>
<parameter>
<name>AutoPlay</name>
<type>boolean</type>
</parameter>
<parameter>
<name>LightboxMode</name>
<type>boolean</type>
</parameter>
</method>
</class>
<version>1.0</version>
<dependsOn>YouTubeAndroidPlayerApi</dependsOn>
</root>
This gave me an idea. Include own xml or txt with the version in the files directory of my application. Single drawback is that when you change the library version will have to change this file . Should work.
Thanks Roycefer. What parameter to (Object o). Where I got it ? (Object o) . I need put this in params:
If nativeMe.IsInitialized=False Then nativeMe.InitializeContext
Dim SQLCipherVersion As Float=nativeMe.RunMethod("GetVersion", Params() As Object) '<=== What's params library name here ?
Whatever Object you want, so long as it has an @Version annotation in its Java code. This will usually be the "central" object of a library. If a library only has one class, then create an instance of that class and use that as the parameter.
I haven't used the SQLCipher library but looking at its documentation, there is only one class and it is the SQLCipher class.
B4X:
Dim sc as SQLCipher
sc.Initialize(blah, blah, blah, blah, ....)
Log("version is: " & nativeMe.RunMethod("GetVersion", Array(sc)))
** Activity (main) Create, isFirst = true **
Iniciando...
main_activity_create (B4A line: 398)
Log("version is: " & nativeMe.RunMethod("GetVersi
java.lang.RuntimeException: Object should first be initialized (JavaObject).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4j.object.JavaObject.getCurrentClass(JavaObject.java:257)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:117)
at com.infranotepro.main._activity_create(main.java:634)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at com.infranotepro.main.afterFirstLayout(main.java:105)
at com.infranotepro.main.access$000(main.java:20)
at com.infranotepro.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
You are right. when I changed the code forgot to do this. Works perfectly !!! Great !!! You are master because in google I don't found this.
now my correct code:
B4X:
Dim sc As SQLCipher
sc.Initialize(File.DirInternal,"xxx.db",True,"dkjfakldfj", "")
nativeMe.InitializeContext
Log("version is: " & nativeMe.RunMethod("GetVersion", Array(sc)))