Services?

Is there any way to also have the game run as a service looking for new events to happen? I want my game to get challenges from other players but not alwasy have the game running in the front. [import]uid: 68806 topic_id: 14210 reply_id: 314210[/import]

Obviously, it cannot run in the background. If the user kills it, then it is terminated. Other than that, you can set up a listener on a particular port and keep listening to events/communications and handle them accordingly.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14210 reply_id: 52441[/import]

Hi Gasher 1985, I have no idea what you are on about. But you are the kind of folks that cause a lot of developers to shy away from helping on these forums. You are on my list, I will think before as much as trying to even suggest something to you. You kids can enjoy…

BTW. when I said you cannot have your app in the background I was thinking iOS not Android, I am impressed to see someone think of Android only, which also means you are a windows user :wink:

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14210 reply_id: 52447[/import]

http://developer.android.com/guide/topics/ui/notifiers/notifications.html (notice the service part)

so sorry to say you didnt help me at all and i really mean not at all. I find it to be really simple yes or no answer possibly a maybe :-P. The answer u gave me thinks u know nothing of android at all. Do you have eclipse installed? Sorry if what i said was asking was wrong but wow.

“Obviously, it cannot run in the background.”

A game isnt a service i know that. I want to take a game that was made in in the 90s and make it way better. So back to the question in hand. Can i do “Background” services like what weather bug uses for weather updates but instead get data for my game and act on the data (if your lost jayantv look at link above). The idea i have i think is pretty awesome and i like corona a lot. one of my other projects uses corona but if this cant happen then i need to start learning how to use andengine for this project. [import]uid: 68806 topic_id: 14210 reply_id: 52444[/import]

Edited by Peach: Explanation in following post. [import]uid: 68806 topic_id: 14210 reply_id: 52455[/import]

sadly i will be banned or deleted cause that idiot was thinking i was talking about iOS [import]uid: 68806 topic_id: 14210 reply_id: 52457[/import]

You wont be banned or deleted this time.

The next time you call someone an idiot for trying to help you or decide to throw a tantrum because you are frustrated then yes, you will get banned.

Don’t act like a jerk here; we wont tolerate it.

Jayant is a valued member of the community and while he mistakenly thought you were talking about iOS, that’s no reason to behave in such a way.

No cursing others out, no acting like a spoiled brat and kindly keep any words about genitals in your diary.

If you can control yourself and keep it nice, you’ll do fine here - otherwise don’t get too comfortable.

Peach Pellen [import]uid: 52491 topic_id: 14210 reply_id: 52467[/import]

*sadly i will be banned or deleted cause that idiot was thinking i was talking about iOS

Also, stop thinking like this. If you get banned it will be because of YOUR behavior, not because someone trying to help you got confused about which device you were developing for. You are responsible for how you respond to a simple misunderstanding like this, no one else. [import]uid: 52491 topic_id: 14210 reply_id: 52468[/import]

Okay fine… Im working with android… They have a thing called a service that run the background even when the main app is not working… I need a service with my game. Is that possible. I need way even when my game is dead to get updates though a web server to say “hay some one wants to fight u”. Thats all i want to know. If it can not be done tell me and i will make it with andengine which uses way more coding than i want and they have no docs. I need 2 way communication based off gps and i need a service to run with out the game running to accept challenges though a server that would feed the game. Sorry one more time. I need a service when the game is not running at all times with the users permission to get info. simple as that. Can corona support in any way a background service yes or no? [import]uid: 68806 topic_id: 14210 reply_id: 52472[/import]

sorry im flustered with the docs and the forum search. just want something at all times listening the background like some apps.(weather apps) I think its a tad more complicated than this engine can handle at this moment. [import]uid: 68806 topic_id: 14210 reply_id: 52473[/import]

Not at this time, no.

However, if you look at this thread; http://developer.anscamobile.com/forum/2011/03/15/push-notifications you will see some decent suggestions for work arounds that may suit your needs :slight_smile: [import]uid: 52491 topic_id: 14210 reply_id: 52484[/import]

afaik you cant do anything like that in corona. You also can’t register intents so it makes it pretty difficult to do what you want without your game running all the time as a normal app. Since android could kill your game at any point thats not really going to work either.

If you really need something like this use a framework like andengine and go native. Aside from some generic push type mechanism, I dont expect many game engines to allow you to create a service and leave it running. A service should be lightweight, register an intent and fire up your app to handle the data. Thats probably not going to happen with something generic like a game engine. [import]uid: 8872 topic_id: 14210 reply_id: 53546[/import]

A few tips from a beginner android developer to our frustated fellow man/woman.

I been testing Corona for about a week and also been missing some andoid stuff. Service is one of them.
One tip is that http://www.basic4ppc.com/ support service, at least from what I read. Also seems like easy coding and with prio on only android. Wouldn’t think their physics is as good though.
Love to hear what you think of them, I cannot decide myself if I going this way or with Corona. I bet Corona will be a lot better in a while with support for android and all the non-game features it’s lacking. Would love to hear what you think.

Another thing though, Looked at the tuts made of Peach.
One of them are talking about “system.setIdleTimer( false )” that would prevent the app going to sleep. This is what I needed the service for, but I havent tested it yet.

Peach - would this work on Android?

Another question for my first teacher Peach - is there anyone at Ansca that are not and Apple-nerd? :slight_smile:
(just had to ask, with all the prejudices out there :-))
(and sorry about the english - just an Swedish language idiot) [import]uid: 84627 topic_id: 14210 reply_id: 53817[/import]

Hey again,

You know, I can’t actually recall whether or not that does work on Android. I feel like it does, but I could be mistaken. (I’ll have to look it up, it will specify in the API section.)

As to anyone at Ansca not being an Apple-nerd, haha - plenty love BOTH iOS and Android - it’s just that Android is ridiculously fragmented so it isn’t such a joy to work with. (My opinion only.)

Personally I’d love to get back into Android, I did a bit with it previously - the problem is getting a device that doesn’t cost a bomb. (Where I come from you really get a bad deal on tech goodies.)

Peach :wink: [import]uid: 52491 topic_id: 14210 reply_id: 53882[/import]

setIdleTimer is only to prevent the screen timer - the screen turning off if you dont press anything for a specified period of time.

There is NO way to keep your app alive indefinitly without running it as a service. It may run for a long time, but at any point android could send it a suspend as part of its memory management. If you don’t suspend/exit android will just kill the app. [import]uid: 8872 topic_id: 14210 reply_id: 53883[/import]

Main issue with android in my opinion is all the different resulotions, not funny.
And Coronas support only for arm7 processors, I dont really know what this mean. Do most of the devices running 2.2 or higher us arm7? Otherwise I don’t see Corona as an alternative at all.

Kam187 - i realize this, but for my first app this can be enough.
The apps main point is that you shall not use the device during the apps lifespan. But ofcourse it will not be optimal for ex. battery life. TNX for advice.

BTW - anyone tried basic for android, comments? [import]uid: 84627 topic_id: 14210 reply_id: 53892[/import]

Ahh ok.

It does work on android… I reported it not working a long time ago and it was fixed way back in build 300-something.

I use it in walkabout to simplify the suspend/resume handling. [import]uid: 8872 topic_id: 14210 reply_id: 53896[/import]

Great!
It is somewhat ugly but then it does the trick for me. [import]uid: 84627 topic_id: 14210 reply_id: 53897[/import]