Update in realtime - ios

I want to create an app that will have real time update. It's kind of like a game. Here's what I'm trying to do:
Players will be playing, and as soon as someone gets the highest score, (while he's playing,) it should show it on all devices, and the score should be constantly changing as the high score user is playing.
I know that this is kind of difficult to understand, but I'm basically trying to get a leaderboard like agars game, where the names are constantly changing.

You can start with Angularjs and Firebase database. Firebase

Related

How to show popup question to start tracking a stair stepper exercise on the Apple Watch?

Is there a way to detect activity in the background using my app like Apple does it?
Currently there's no way to calculate stairs climbed by the user while using a stair stepper machine using the Apple Watch/iPhone. We want to be able to detect activity in the background if our app is installed and ask them "It looks like your climbing stairs on a stair stepper". The only thing I can think of is to do a Background scheduler event, but the shortest period allowable is every 15 minutes which is almost at the end of any work out with a stair stepper machine.
Is the Apple Watch using inaccessible private APIs to achieve this behavior? Or is there a way we can achieve it too?
I have never tried it but I think it can be done with location region monitoring and some ML.
Keep track of where the user is when they trigger workouts, and the time. Maybe even heart rate and any other data that might give you clues.
When you get notified that the user is in that spot, check for activity and/or clues with ML and send the notification.
The watch only seems to send that notification if it knows the area where you are is a workout area and the right time.
Apple has ML videos where the user can train a model on device. I think their sample shows a restaurants app where depending on time, day, and location you can suggests restaurants to a user.

Editing sort order of a Live iOS GameCenter Leaderboard

I setup a GameCenter leaderboard on my iOS app. Unfortunately, I set the sort order for scores from 'Low to High', rather than 'High to Low'. Now player's best scores appear as their lowest scores rather than their highest scores.
The app is now live and so I cannot seem to edit the sort order. Does anyone know a clever way round this? I tried linking to a different leaderboard, but it seems in Unity you cant link to specific leaderboards.

Can Game Center Track total time played?

Curious to know if Game Center tracks total time played per app? If it does, how could I easily query this data?
Thanks!
No, you cannot use game center to do this. There are a couple of options though.
You can track it locally, and then upload the data to a game center leaderboard. I don't know if you want to do that though because then everyone can see how much a certain player has played
You can use some sort of analytics service, like Google Analytics and ping it periodically while a player is on the app so you can see how much people are playing
Or you can set up a server and database, where the player sends their play time when they are on the app

Is it possible to issue an alert when a GameKit opponent is ready?

I made a game using GameKit and I am using the framework to manage a real-time match between two opponents. If I invite a specific person to a match, or make sure they are "waiting for opponent" at the same time as me, the match and game goes smoothly and everything is great.
The problem I have now is that there aren't a lot of people on my app yet, and so people that are wanting to play against a random opponent who also wants to play, don't have any way of knowing when a match could be ready.
Is there a way to utilize GameKit, but enhance the experience so that a push notification or alert of some kind is sent when an opponent is found? It could be this is all built in, but I'm not seeing anything.
AFAIK, GameKit does not support push-notifications for matching real-time games while your App isn't running.
But, GameKit has a Player Activity API that tells you how many matches were requested in the last 60 seconds, and you could use that number to create an informative message or status to show the player.
EDIT: the methods in question are
- queryActivityWithCompletionHandler:
- queryPlayerGroupActivity:withCompletionHandler:

CloudKit and GameCenter in a game?

I am working on a game. It will use Game Center for multiplayer. I would like to be able to use CloudKit for storing levels and the local CloudKit container for storing game progress. The problem is that this requires to different accounts. Any ideas on how to link them together?
I struggled with this recently when building in syncing to my game Qiktionary. At first I associated single player game data with the currently logged in Game Center player. So when I started working on sync, I was associating the single player game data in CloudKit with the Game Center player by using a separate CKRecordZone (in the private db) for each Game Center player.
I ended up abandoning that approach because it turns out that causes some behaviour that looks to the user like data loss. For example, GC Player A is logged into your game and plays 10 single player games (or in your case, levels). Later they happen to log out of Game Center, and even later than that they come back to your game and since they are logged out, they no longer see their 10 games played. It's not obvious that the game data is there but just "missing" because they are now logged out of GC.
I did some research and most other games don't work like that. Single player game progress is not linked to the logged in Game Center player. Which means that the single player game data in CloudKit shouldn't be linked to the Game Center player either.
This is even how the GKSavedGame API from GameKit works. According to the docs:
Saved games are tied to the iCloud account, not the Game Center account

Resources