Confused newb! activities vs services

Put your problem here if it does not fit any of the other categories.

Confused newb! activities vs services

Postby burrkie » Wed Jan 06, 2010 4:05 pm

OK first off sorry for such a stupid question but I'm just confused!

I'm trying to make a game which uses audio cues, GPS, and say something like a client/server multi-player part to it.
But what I don't understand is what should each part be. Should I just create a class for each part and have like a main activity which calls them or should I have each as separate activities and have one main one call them....or should they be services because they will always be running in the background until the game ends.

Just in case it matters the game will consist of the GPS tracking the players movements and when they get close to a point the audio cue will kick in and speed up the closer they get, and the multi-player will have position messages passed between the client and server for the entire game.
"You'd better watch who you're calling a child, Lois. Because if I'm a child, you know what that makes you? A Pedophile. And I'll be damned if I'm gonna be lectured by a pervert." - Peter Griffin
burrkie
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Jan 06, 2010 3:54 pm

Top

Postby wirelessdesigns » Thu Jan 07, 2010 5:36 pm

Welcome, sounds like an interesting project. I think some basic definitions about Activities and Services might help you sort things out.

An Activity is a single view that the user is interacting with, and should usually be scoped to a specific function. If your application has multiple modes, views, etc. that a user will move between, they are commonly each placed in their own Activity. Android has a fairly robust set of methods to allow Activity classes to start one another and pass data back and forth using Intents.

Services are processes designed to run in the background when your entire application is either not visible, or not running. Services are not generally utilized for background processing within an active application (although they can be). Instead, background processing is generally done by spawning Threads to keep the blocking code off of the UI.

Hope that helps!
wirelessdesigns
Developer
Developer
 
Posts: 25
Joined: Fri Dec 18, 2009 3:27 pm
Location: Littleton, CO

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 26 guests