Save game/user statistic in a central database with swift and sql on IOS 8 - ios

I am making a game for IOS 8 using the Swift language. For each level I was planning to save data such as how long it takes to solve the level, what (x,y) position a player dies, how many attempts before solving the level etc. I will then use this information to improve the game by adjusting the difficulty of levels.
So I figured I would have a simple SQlite DB stores locally with this information. And then I wonder how I should upload this information to one central database. Any ideas?
For example, what kind of unique identifier can I use? I don't care about the individual data, just the average time to complete a level and the average nr of attempts to solve a level..
But, if I have in-app purchases, how can a user that delete the app, or get another iphone restore the purchases made? This is again related to a unique identifier that is connected to the user, not just the iphone.

You really should be using analytics tools to do this. I would recommend using Flurry. Its free to use, and goes into your game very easily.
http://www.flurry.com/solutions/analytics
I have used it in a number of products. You can send in the anonymous data you want based on events. So every time a level is complete, you can report it to flurry as an event, and pass parameters of level, score, and completion time.
You can look at a nice dash board to see the results and averages.
Its easy to incorporate it into a Swift app. Another SO answer goes through this in detail.

Related

API to push data to HealthKit

My ultimate goal: I want to automatically log my weight to healthkit on my phone every time I step on the scale.
Secondary goal: I don't want to spend much money, but I do want to learn. I'm a computer engineer and enjoy building hardware, but I don't just want to buy an off-the-shelf smart scale and install their app. Part of this comes down to data security: I don't like my information (especially health information) being in somebody else's hands.
Tertiary goal: I don't want to need an apple developer account (e.g., to roll my own on-phone app or something) but if I have to compromise here I will.
I want this to be as painless a process as possible - I've seen solutions that involve setting up a shortcut to ask for your current weight, etc, and I don't love that: less user interaction is better.
I'm usually wearing my apple watch when I weight myself, but might forget my phone (it's often right after a workout before I shower), if that helps.
I've seen a lot of questions on here talking about querying data, and I don't care about that: I'll use the phone to look at historical data, but I want to enter it automatically/painlessly so I have some data to look at.
For instance: I could set up an NFC sticker to open a shortcut, and maybe the process of scanning the sticker holds my phone in a specific place to read a QR code output by the scale? I honestly don't know if scanning a QR is possible in a shortcut, but this is just an example. The downside here is that I would need my phone on me.
The most promising solution from what I can tell is to build my scale to send the weight to google fit's API, and then install the google fit app on my phone to sync automatically. The downside is exposing my info to another service (google fit) rather than just keeping it in HealthKit, which I'd prefer.
Is there an auto-magic URL format that could trigger an iOS behavior to enter the data?
Is there an API through iCloud to just submit the data and not query it?
Is there a bluetooth option to talk to my watch and sync data there?
I see a lot of questions for querying/reading HealthKit data, but very little on submitting/saving it - so I'm not sure what's possible.
Suggestions appreciated!

How do I go About Creating Exam Prep with Flutter?

I want to begin a mobile app project for my college, i want to make use of flutter but am a beginner. The app is going to base on past questions of various departments of my college.
The questions will popping randomly with timer. How do i go about this?
I also need suggestion whether to make the app Online or Offline.
Making it Online, am thinking of getting the random questions from a rest API that outputs results in JSON but some of the users of the app might not be able to afford buying internet Data.
Making it Offline, i need how to go about this with Dart/Flutter. and also i'd like the size of the app not to be much as having questions stored in the app (Offline) might increase the size of the app.
I need suggestions on how to achieve my aims with Dart/Flutter please.

One IOS App, 3 countries domain using 3 different Data bases

We already have E commerce app Targeting 3 different countries with 3 different domains. It also uses 3 different DB.
Now we are going for IOS app. So my questions here are:
Can we upload a bundle for specific country only? (Available in that country only, if multiple bundles allowed for single app)
Should we handle JSON based DB request in a single bundle by checking user's location? (so single bundle handled by programming)
Our goal is here our app will allow only specific country's user to place order.
Also prices are different for different countries, prices are from server.
We don't have in app purchase prices.
Please let me know what option is best. Even if new please suggest.
Its a broad question with lots of good answers and unfortunately all of them are opinion based but I will give my two cents.
You can absolutely create multiple apps and target a specific country. You control this by changing the availability preference. (see pic) This will allow the app to be shown only in a certain country.
The advantage of this method is that you can have complete control & customizability specific to a country.
The disadvantage is that you are now maintaining multiple code bases. If you have a code bug in one app then you need to update 3 apps to fix the "same" bug. What if you want to support more countries. Now you have to create that many clones of the app. Think about if you had to add a new feature. Its snowballs pretty quickly doesn't it?
If you make one app then there is only one code base, one place to make all code changes or add features. Its somewhat easy to maintain code wise.
The bad side, well now you have to take care of every possible country specific scenario either within the app e.g. Localizations, currencies etc. or you have to get that information from your servers.
There are ways to find out through apis from which country a user is connecting from without asking the user itself.
In my opinion, creating one app is the way to go. It will save you lots of headaches down the road. But having said that I don't know how UBER or others big international players handle their country specific apps. Do they have one app or many. That I don't know.

A/B testing(show new feature only for 50% of users)

I'am creating a new feature for my iOS app. After I publish the app I wants to show the new feature only for 50% of the users, so I can do some testing which version makes more orders. I have no idea how to do it without using some third parties like Optimizely.
Also is it possible to do this using Google Tag Manager(GTM).
So can someone please help me to figure this out.
Thank you very much for your time.:)
It’s hard to do it on your own, though not impossible of course: Optimizelys of the world are just programs. You’ll need to solve these problems:
Targeting: Some algorithm that will assign user session to either control or (one of) treatment(s). This has to be random, of course, or you may as well stop there.
Routing: Send sessios to the targeted experience.
Logging: You’ll need to intelligently log events from sessions as they traverse their targeted experience. These may be many, so be careful not to add latency to your app path. Your statistical analysis will be based on these.
Experience stability: how do you ensure (if you do) that a returning user sees the same experience he’s already seen.
Note as well, that Optimizely will only help you if all your changes are on the device and not on the server. If you need to instrument server changes as well, you’ll have to look into Sitespect or Variant.
I finally figured out how to do the A/B testing with 'Google Tag Manager'(GTM).
In GTM you can create a variable called 'Google Analytics Content Experiment'. With this variable you can select how many percentage of users going to see each Variation(your experiments). You can create up to 10 variations for single experiment.
GTM is so cool and powerful. GTM contains so many features that could save lot of time and I totally recommend it for anyone who is going to do A/B testing.

Accessing data from HealthKit with Swift

I'm a complete noob at Swift (and Xcode), as a matter of fact, the only programming language I (somewhat) know is Javascript.
I'm trying to make a Swift SpriteKit game, and I would like to access the number of calories burned in HealthKit.
The idea is that my game will provide more points the more calories you burn using other apps like Endomondo. My app does not actually track anything, I would just like to access other data left by other apps in the Health App.
Is this even possible? (I'm running the latest version of everything, from Mac OS X to Xcode)
Certainly. I don't think there is anything technically preventing you from making calls to the HealthKit APIs in your game. In fact, you're fairly free to mix and match the use of any public frameworks provided on iOS.
One thing to keep in mind is privacy and disclosure of the use of health data. The user will have to explicitly grant your app permission to see data.
HealthKit is a really rich API with lots of ways to access lots of different kinds of data, and you're really only interested in a small part right now, so a quick way to experiment is to create a new Swift SpriteKit game from the new project template in Xcode, do your research on HealthKit, and see if you can just log the number of calories burned since some time point while your app is running. If you can do that, the rest is details (as in, the entire app :-)).
Here are what I think might be some helpful links, good luck on your project!
https://itunes.apple.com/us/book/swift-programming-language/id881256329?mt=11
https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Framework/index.html
You'll also find some good documentation on SpriteKit (references and guides) on the iOS Developer Library site.

Resources