Java Question Wrapped Library need an Activity

DonManfred

Expert
Licensed User
Longtime User
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
TVstartTeamViewerSession( )
Create config...
config created... now doing createTVSession...
IllegalArgumentException: java.lang.IllegalArgumentException: activity must not be null

i´m calling this method of an library i am doing a wrapper for b4a

B4X:
    public void startTeamViewerSession(BA ba, String serviceCaseName, String serviceCaseDescription) {
        try {
            ba.Log("Create config...");
            TVSessionConfiguration configuration = createConfiguration(serviceCaseName, serviceCaseDescription);
            ba.Log("config created... now doing createTVSession...");
            TVSessionFactory.createTVSession(ba.activity, SDK_TOKEN, createSessionCreationCallback(this.getInstance(), configuration));
            ba.Log("TVSessionFactory.createTVSession executed...");
        } catch (IllegalArgumentException e) {
            // either the configuration, or the parameters of the factory are invalid
            // no error handling wanted
            ba.Log("IllegalArgumentException: "+e.toString());
        } catch (IllegalStateException e) {
            // the app's manifest is missing permissions or the service declaration
            // no error handling wanted
            ba.Log("IllegalStateException: "+e.toString());
        }
    }

This is the called method from b4a in my wrapper

B4X:
    public void startTeamViewerSession(BA ba, String svcCaseName, String svcCaseDesc) {
        this.getObject().startTeamViewerSession(ba, svcCaseName, svcCaseDesc);
    }

and the b4a code calling this method

B4X:
    Log("TVstartTeamViewerSession( )")
    TV.startTeamViewerSession("MyName","Helpdescription")


The two CATCH blocks are empty by default. I just put the logs here to see what happen and i got the obove result

B4X:
        } catch (IllegalArgumentException e) {
            // either the configuration, or the parameters of the factory are invalid
            // no error handling wanted
        } catch (IllegalStateException e) {
            // the app's manifest is missing permissions or the service declaration
            // no error handling wanted
        }
Can anybody help me on what i´m missing here or what could be the problem?
 

warwound

Expert
Licensed User
Longtime User
Try adding the annotation:

B4X:
@BA.ActivityObject

Without this i think ba.activity will always be null.

That implies your startTeamViewerSession method can only be called from an Activity - not from a Service.
 

DonManfred

Expert
Licensed User
Longtime User
The error which happens is maybe that the lib cannot find one of the provided native libs...

liblogging.so. But it is inside the jar inside folde armeabi-v7a

tvscreensharing0026.png

tvscreensharing0027.png



B4X:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/b4a.example-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]] couldn't find "liblogging.so"
    at java.lang.Runtime.loadLibrary(Runtime.java:366)
    at java.lang.System.loadLibrary(System.java:988)
    at com.teamviewer.corelib.logging.Logging.<clinit>(SourceFile:24)
    at com.teamviewer.sdk.screensharing.internal.ᕁ.ˊ(SourceFile:503)
    at com.teamviewer.sdk.screensharing.internal.ᕁ.ˊ(SourceFile:60)
    at com.teamviewer.sdk.screensharing.internal.ᕁ$1.run(SourceFile:397)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
start_output_stream (0xed906320) out->config.rate:48000 out->config.format:0 out->period_size:240
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
 
Top