Reputation: 2067
I am writing android game that uses Swarm database. My problem is that they only allow to store one variable and I need three. So I created nine leaderborad to represent different variable sets.
When I need to show scores in my app I need data from all the leaderboards and I make nine request from Swarm database, however that creates nine threads.
Is there a way to use only one thread? Maybe using Thread.join() method? Where all the downloads would be done one at a time. Or that will take a lot more time?
Thank you:)
Upvotes: 0
Views: 197
Reputation: 21
Assuming you mean the data associated with each leaderboard score can only be one variable:
I think the correct answer would be to define a data format to submit all of the data, as one variable. For example, if you're looking to submit 3 integers, why not submit them as "int1,int2,int3" and expect them to come back that way? Or take advantage of JSON and attach your data to the score as a JSON array "[int1,int2,int3]".
Upvotes: 1
Reputation: 156
It looks like (as you point out) you can submit payload data with Leaderboard scores, but if you just want generic data storage then probably should be using the Cloud Data feature. You're correct that each call will spawn of a separate thread, but in the case of 9 threads, that shouldn't really impact performance. Also, I'm guessing that once the data comes back, the thread is killed off anyway.
Just curious, what's the motivation for reducing the number of threads from 9 down to 1? If you need to connect with the Swarm support team, I think you can reach them by shipping an email to [email protected]. They're usually pretty responsive.
Upvotes: 0