IOS implementation advice - objective-c

I want to develop an application that stores user's data on an SQL server.
The data contains location and some user note.
I don't want to store anything on the user's iphone.
So what i want to do is an application that gets the user location and check with the server if the location changed for about 100 meters.
I believe this has nothing to do with push notifications.
Am i right? And what do you suggest on how to implement it....
Just Give me an overview of your solution please.
Thanks

This has nothing to do with push notification.
Although, I assume you want to do the same thing than the foursquare application : when you want to checkin, the app sends to the server your actual position, and the server sends back the list of places around, then if you move from a certain distance from your originally point, the app asks the server again for a new list.
So basically, I would just check every 30seconds the position of the user, and if the difference between the last and the current position is above a threshold, just send a request to the server.

Related

Express/Socket.io browser game deployed on Heroku doesn't work as expected

I have been working on a hobby browser game project. I use Express and Socket.io to add real-time feature to the game. My game is currently working 60FPS, it updates player's browser window every 16.67 milliseconds. Each frame, client's current position and it's pressed keys data sent to server via socket.io and each frame client receives other users' positions and pressed keys etc. I think that's pretty much of work for free service on Heroku.
You can check my project and problem using this link: https://test-game9.herokuapp.com/
Problem: Currently clients are able to move around using W, A, S, D keys. And they can see other user's movements. Nothing else. But for some reason my game deployed on Heroku flickers. This flickering problem doesn't occur on localhost. I wonder what's the problem. Do I miss some kind of socket.io options?
Thanks in advance.
It's hard to say what is wrong with this game without reviewing the code. However my guess is that you are not considering the network latency that's why your game works in localhost but not when deployed.
When I move using WASD, my object instantly moves. Which indicates that you are directly taking player's action into effect and update object's position then send the position to others. However the preferred alternative is that when player press any movement key, The information about the movement must be sent to the server first then broadcast it to everyone including moved player itself. Even though it's the player's object, player must listen for network to change position instead of doing it locally and instantly like single player games.
Another possible problem is that you are probably using an interval to send player's object position every N milliseconds whether anyone moved or not, This might be another cause of flicker. Instead you can just send position only when someone moves.

Is it a good idea to get user data from local storage and not from API?

I need to show logged in user's profile image in the header. But I don't want to call API on every page where header stands. Is it a good idea to store current user information in local storage? So I can immediately get profile image and display in the header without an extra network traffic.
If you want to always get it from the local storage, then how do you want to make sure that they are up to date? I think that's one of the problems which single page applications try to solve it.

Daily scheduled notifications

I need a bit of guidance, so for my application i'm looking at using local notifications to send a notification every morning at 7 o'clock.
The issue i'm having is how can i make the content for the local notification dynamic mainly the body and the attached image? As it will vary for the user on a daily basis.
What would be the best way to go about this since you can't edit future notifications.
Here's a little lesson about notifications. First, what is a notification? It's basically an alert presented on your behalf by the system. Second, there are two kinds of notification: local and remote.
Let's imagine, then, an app that aims to present a notification to the user every morning at 7 AM saying what the current temperature is outside. (Assume for purposes of the example that we have a way of learning this information.)
A moment's thought will reveal that this cannot be done with local notifications. We cannot know the current temperature at 7 AM until 7 AM (or close to it) and we cannot schedule the notification unless the app is running. Therefore we would need the great good luck to have the app running at 6:59 AM in order for this app to work. But an app only runs when the user summons it, so that is extremely unlikely.
Therefore a task of this kind is possible only with remote notifications. A remote server is always running; therefore it can get the temperature and "ping" the user's device at 7 AM, and the system will present the notification on your behalf. You would therefore need to possess such a server in order to write the imagined app.
(An alternative using local notifications would be this: You schedule, say, a week's worth of local notification in advance. Then if you have the great good luck to find the app running before a notification is presented, you tear down all the scheduled notifications and do it again with a more up-to-date forecast. But of course this cannot possibly work as well as using remote notifications, and it will stop working entirely after a week if the user doesn't launch the app. That, to put it bluntly, sounds pretty lame.)

C2DM question on fitness of purpose

I want to be able to push messages out to certain customers who have a particular postcode. Is this possible with C2DM or is it a case of only pushing to everyone who has the application?.
It is not possible to determine the postcode of a device via C2DM. But you might use the
localization feature of Android and use this information to find the postcode.
Edit: Or just ask the user to enter his postcode ;)
Thus, your application needs to register at your server it could also submit the location information (in another step), and you could save it in your database along the device id.
Then you could send a message to all users that are in a specific area.

Time limited Shareware

I'm thinking about making a time limited full version of my App, so users can try it for example 7 days.
Is there a recommended Obj-C library?
First of all do not store your data inside the app. Otherwise it would be simple to delete the App from the filesystem and download it again restarting the countdown. Store it in User preferences or Application Support instead. You could use a plist for this. You could also use a hidden file if you like. Just don't make it too complicated or too invasive. Your app can be cracked no matter what security measures you use in the end. Just be fair enough to the end user that could be a prospective customer.
Here is a very nice link on the topic of implementing a time-limited trial in Cocoa:
http://lipidity.com/apple/shareware-licensing-techniques/
Without possibility to protect your data from manipulation/deletion it is not possible to do.
How do yo check, if it is first start of your application, if all your data is wiped out.
Some alternative is "hardcoded" id token and connection to the rest of world (at least for first start, to grab any kind signed data key)
Maybe you could use a server where store UUID's and first time they launched the App. Then, Each time they open your application, it asks your server if they can use it or not. It's harder than store dates on device but if you do that, users will access your application simply changing the date of the device on Settings.