I'm seeking more an advice on where to go next, rather than how to do it.
I'm developing an augmented reality Android game as a student project, and I've stumbled upon a problem. Four phones have to know each other's position and show it on a map with time steps (it should not be really realtime, for the sake of the game). Besides that, the players should be notified when one of the phones/players gets to some location, or does something.
I wanted to do it with a PHP service, where each phone would check in a couple of seconds for the positions of the rest (all by JSON), send it's position and that's it. Quite simple, but I'm afraid that there will be a lot of desynchronisation and unconsitent data as the game progresses. Since the phones don't start at the same second as everyone signs in. Also, I'm not sure how to do the events this way (for example, one of the players can cloak and his position should not be updated anymore in the next x seconds), or get to a location, or what items are still on the map (players can "pick up" items). Someone will know earlier than the others.
This really calls for a push-like solution, but I'm not really familiar with C2DM, and it seems to me that using it is a real overhead in development, and I need a C#/Java or similar server as PHP certanly can't push to the cloud (or can it?). I know C# and Java, but it takes more time as I need to solve threading and so on. Can C2DM even be used for this?
Basically, I'm seeking thoughts of more experienced developers, what is the best solution here for sync? Is there any way to remedy the problems with PHP and periodic checking the server or should I continue with the cloud service and a more complicated server?
Sorry for the long explanation :) .
Sorry that this isn't simpler but I've encountered pretty much the exact same problem in my own app and there is no way to avoid this, you need;
a server with a REST API to manage and distribute data
a way to set up friends / groups
a way to push data
Google Cloud Messaging really isn't that much trouble.
Check out the Google IO 2012 code, they've made use of it there with not much code.
http://code.google.com/p/iosched/source/browse/
What you really need to build is a rest api with quite a few functions for being able to identify devices and set up these groups of friends. I would suggest using Facebook integration for establishing a friend network.
https://developers.facebook.com/
And there are infinite ways to set up the REST API, but the fastest I've seen was released this year at google IO and thats Google AppEngine EndPoints.
http://devthots.blogspot.com/2012/07/building-awesome-android-apps-with.html
Give Comet a try, it's all about http requests
Related
I have been able to avoid database, webserver setting 20 years, but now I face it. I found so much information that I rather ask before messing all around with a broken system.
So, I need to host about 10 discussions that have about 25 messages each, older I want to remove. So this is really light weighted. My first idea is to have data in JSON format only because I have some experience on that. Data will be accessed from android application.
Now I have been boiling my brains with, mongodb, micro_httpd, libmicrohttpd, json-server, nginx, nosql, nodes, mariadb, mongodb... and it is time to make decisions.
While data is accessed from android application I wonder do I even need any webserver, actually, I dont necessary want that people can browse to host and read everything from browser. Idea is to use example Get to get sender, subject, message into android textviews and same to opposite direction. Thats why I started to think some api or database that can be connected from internet, but webserver is also ok, if stuff can be hided.
This is not a tutorial place, but if someone with experience could propose some setup for me and directions? I have googled pretty much all tutorials. In first setup I would be happy just to receive and send messages to database/api/webserver/webservice, but later on it would also be nice to have some authentication, and one important, somepoint there will be spam coming anyway and I read something about putting sender ip address five minutes to halt. Captcha would be very appreciated, I guess I could open one in android webview. And from our team leader, apache is not an option while it can leak some information (though I didnt see that dangerous). And to remind, this seems something really light.
I think Firebase is the best solution for you: easy to use, no server database complications, easy to implement. Watch some up-to-date videos from the web and you are set.
I was hoping someone could help me with a question I have.
If I want to consume data from several API's in android (they are checked once a day for changes) and then I combine all of the data and do something with it, what would be the best way to do this from a resource and memory point of view ?
An example would be getting bus timetables from several bus companies operating in a city and then showing what busses are leaving in the next hour for example, that is relative to your location.
I do know how to consume Rest API's in Android, I am just wondering if there is a better way than calling say 20 API's once a day and storing the data ?
If I have not explained the question well enough please feel free to ask me anything and I will try and explain it better.
Thanks in advance.
I think you should make a few question about your solution.
Does your solution require the access to 20 different api's and the mobile app will be distributed in more than one user? If the answer is YES then you need a backend. The backend will execute a batch process to access the data from the 20 sources, consolidate the information and will be available for as many client devices require that information.
If the information will be not updated, you can make one call per day to the backend and keep it cached on the device.
If your app get more complex, could even receive notifications about changes on the data so it could update it.
Hope it helps.
I want to make an android application which will display an external message (For example: some quotes, proverbs etc) daily.
The message should be retrieved from some place other than the client device and I would like to configure the messages from back end
These messages should also change everyday.
How should the back end be and how can the android application retrieve the configured message ?
Do I need a server at the back end for the same or can avail some cloud services for the same ?
What is the best approach to do?
If you want to avoid having to set up and manage a server on the backend yourself you can take a look at a 'backend as a service' offering.
Two example candidates are:
https://parse.com
http://aws.amazon.com/lambda/
Both Parse and Amazon provide SDK's to allow you interact with the backend from your Android app.
You will likely want to study this a little to decide if you want this type of solution or to build your own server as Brian suggests - I think there are pros and cons to each approach and you'll have to choose which is best for your case.
Yes, you will need a server. You can start building the server software on the same machine as your Android emulator and create them in parallel. You'll need to choose a language and most likely a web server framework that suits your thought process and style.
If you want to use REST, for instance, google some for "best REST server framework". You will get hundreds of answers that don't mean much, but look at the communities that surround the frameworks that come back. Look at the user lists and how many questions about it exist on this site. That will give you a better idea of whether you can ask questions and get answers when they arise. You are making an investment by learning a framework, spend a little time deciding which one you are going to use, possibly by trying a few of them for a very simple site that returns the kind of data you are looking for.
Other than that, you really need to ask specific questions once you've chosen a language and a framework. Hope that helps.
I know this has been asked before (did not find a straight forward answer) but can I (Or how can I) create and Android App using CSS/HTML/Jquery ?
I will not need to hook into native functions, such as the accelerometer, camera, or even the Toast Messages...I only need to create an app to show a list of names and some details when name is selected, therefore I don't know if it's worth learning to make my life more complicated for something like this.
PS: I need the app to work offline, otherwise I would have just made it with jQuery Mobile and uploaded it on a server.
UPDATE AFTER GETTING DOWNVOTED
Ok, so I get downvotes for this question, probably because it's been asked before, or maybe not, since he/she didn't take the time to write a reason...
Anyway, my point is: I did googled it and searched, but at this moment there are a lot of ads of websites and web apps that will help you do this BUT are they reliable, safe..do they really do the trick or it comes with bugs? That is why I asked the question, to see who used what and what was their experience with it. So yeah, you can downvote me for not trusting every ad and not taking the time to try out everything out there!
Well you can use https://software.intel.com/en-us/html5/tools to develop cross-platform apps. I used it to develop too. It is quite good but it only has one major issue: you can't use php. It also enables you to do on-device testing.
Folks, I'm trying to see if my plan realistic at all. I'm ne to
Android platform but not new to software development. This is my first
post here as well :)
We want (in our company) to create Android software to compliment our
truck management software. Basically, it will do couple very specific
tasks.
a. Send GPS updates to server.
b. Receive trip information.
c. Send pickup/delivery confirmation to server.
After evaluationg i. platform and Windows phone 7 platform we came to
conclusion that only Android has multitasking that works for us. So,
Android it is but I have some specific questions.
Data plan we want to use will be very limited. Probably 5M/mo and
no voice/text. I figured 5x1024x1024 = 5242280 bytes will give me 1k
per transmission every 15 minutes (3000 transmissions per mo). It will
leave 2M for other stuff that will happens every couple of days. Does
my math look OK or there is lot of "waste" traffic? Our server going
to be XML SOAP and messages sent will be just Lon/Lat in XML package.
1K will be OK? If I just calculate bytes it will be even less but I
wonder if there is "minimum" packet size, etc. Any insight on this
data limitation appreciated.
Because of #1 we need to "lock" device somehow so there is no other
software that uses network. Possible? If so, what do I need to look
for? I found already created app - firewall and it says phone has to
be rooted for that.
Receiving trip information. What's the best way to accomplish that
given my situation? Should I run some kind of listener? Will my phone
have IP address or something? Or should I get small text plan and use
that for this specific functionality? Can I receive text message in my
own application?
So, as you see we trying to shrink $80/mo service to $15/mo service
that will do big savings to our company but not sure if it's all
possible with constraints we have. Also, we may just give discounts to
drivers who have Android phone and will install our app but we don't
count on that.
Thank you in advance for any help on this subject.
UPDATE:
Now that I think about it - limited data plan present challenges initially but actually helps us do it "right" to make sure we don't overload server with constant polls. What I really like to see is some real-worls experience with data usage. Problem is, to us to even come up with test app - will require considerable effort. Would be much better to rule this out right now if it won't work. For example, if I knew that message size 2k no matter how big of a message itslef - then I would know immediately that it won't work for us..
If you have a very limited kind of data that you are transferring, the overhead of xml might be unnecessary. Instead, pass .csv data to different endpoints dependent upon the data that your are transfering (one endpoint for lat/lon, another for pickup/delivery confirmation)
You do have an ip address on each device, but you're not necessarily going to know that information - it's not constant, or consistent (it can change as the phone moves around). Instead, do a timed polling of the server (that would make your 3rd endpoint) See other mentioned solution of triggering on SMS.
As far as locking the device, I'm not sure about this, but it certainly seems feasible (though it's not consistent with your 'discounts to drivers who have Android phone'. I understand why, but if the phone has no voice/text capability, it's not likely that the phone will be used by the drivers for much besides it's expected purpose.
You are not going to achieve this with a default Android ROM in other words you have to create your own customized ROM from scratch and deactivate quite some stuff in order to get your devices not to use up the 5M/Month.
You can checkout the developers site on the Android source code to check out if that would be an option for you. Giving discounts to drivers owning an Android phone sounds nice and all but I'm quite certain that this is not going to get the desired results which I guess are that you equip all your trucks with such a device and track all of them.
In my opinion it is not going to work with a data plan of 5M/Month but on the other hand I don't know the data consumption numbers without testing.
UPDATE: Also I would not go with XML but with JSON due to overhead.
When you upload a GPS update, have the server reply with any of the trip data you need to push down to the phone at that time.
I think that for the data traffic (the other topics that you asked about are already solved in the other answers) using a bitmask-like solution will be the best option, first bits are for lat, the next for lon, and then some bitmask for the flags, and sending text data only if it is necessary.