How to setup Parse live query with Android (Java) with self-hosted server URL

292 Views Asked by At

I'm trying to use Parse live queries in Android Studio following this back4app guide. I enabled live query and set up the LiveQuery client following Steps 1 and 2 in the guide. However, I am having trouble with Step 3 (subscribing to the query). Here's what I tried:

// Back4App's Parse setup
Parse.initialize(new Parse.Configuration.Builder(this)
    .applicationId(APPLICATION_ID)
    .clientKey(CLIENT_KEY)
    .server("wss://<my_subdomain>.back4app.io/").build()
);
// Init Live Query Client
ParseLiveQueryClient parseLiveQueryClient = null;
        
try {
    parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient(new URI("wss://<my_subdomain>.back4app.io/"));
} catch (URISyntaxException e) {
    e.printStackTrace();
}

replacing the application id, client key, and subdomain appropriately. But this resulted in an error: java.net.MalformedURLException: unknown protocol: wss and I was unable to create the Parse application. I tried replacing wss:// with https:// in the server URL. The application ran, but every Parse SDK request returned error: unauthorized. Before changing the server URL, I had been using "https://parseapi.back4app.com" and everything worked perfectly. I'm unsure how to fix this issue - any help would be appreciated. Thanks.

0

There are 0 best solutions below