Search code examples
javaandroidioslibgdxnextpeer

NextPeer Initialize on LibGdx


I have gotten all my Tournaments setup, Callbacks going ect... but I have one problem, and it is a big one: How do I initialize?

Okay, I can init for Android, no biggy, but I am looking to let this application run on both Android & iOS. So... I don't know what to do. Does not look like it is possible, but then again, maybe it is and I am blindly looking over where to do so.

Here is the page that teaches you how to Init for android & iPhone SEPARATELY, not together: https://www.nextpeer.com/how-to-make-a-basic-integration-with-nextpeer/


Solution

  • Like this in pseudo code;

    public interface Resolver {
        void init();
    }
    
    Android implements Resolver {
    
        Android() {
            new AndroidApp(new LibGDX(this));
        }
    
        init() {
            // Code here
        }
    }
    
    IOS implements Resolver {
    
        IOS() {
            new IOSApp(new LibGDX(this));
        }
    
        init() {
            // Code here
        }
    }
    
    LibGDX {
    
        LibGDX(Resolver resolver) {
    
            resolver.init();
        }
    }