Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old October 23rd, 2011, 01:00 PM   #1 (permalink)
New Member
 
Join Date: May 2010
Posts: 8
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Network management

I received a request for an app, but I am having a bit of difficulty getting started. Right now, I don't have any code written. I'm in the middle of the research stage, but here is what the app needs to do.

1. Run in the background (preferably in a way that it does not get auto-killed, kind of like EasyTether)
2. Searches for network signal and if one is not found after a set interval of time (e.g. Five minutes), put device into Airplane mode
3. After another interval of time, app will search again for network signal (meaning that Airplane mode will need to be disabled)

The first one I cannot find any information on, nor have I found a way to detect network signals (e.g 3G/Wifi). However, it looks like I can possibly use the Timer class to set the time intervals and the Settings class to activate and possibly disable Airplane mode. How can I deal with the need to continously run in background and search for network signals? Also, I would appreciate if anyone can think of better classes to use than the ones I think I found (e.g. May be simpler to use or more fitting as the class may not provide the needed functionality).

gotenks05 is offline  
Reply With Quote
Sponsors
Old October 23rd, 2011, 03:44 PM   #2 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 308
 
Device(s): Samsung Galaxy Nexus
Thanks: 0
Thanked 52 Times in 51 Posts
Default

You need a service to run in the background. You can use the AlarmManager to start the service at set intervals to check for signals. To check for signals you can use PhoneStateListeners method onServiceStateChanged.
__________________
Android: Personal Storage, Lars Monsen Facts(Norwegian)
miXer is offline  
Reply With Quote
Old October 24th, 2011, 10:43 AM   #3 (permalink)
New Member
 
Join Date: May 2010
Posts: 8
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by miXer View Post
You need a service to run in the background. You can use the AlarmManager to start the service at set intervals to check for signals. To check for signals you can use PhoneStateListeners method onServiceStateChanged.
Thanks for the info. Is there anywhere with example code on PhoneStateListeners? My searches ring up nothing, but I did find one in the demo apps for AlarmManager.
gotenks05 is offline  
Reply With Quote
Reply

Bookmarks

Tags
airplane, android, network, signal, time


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:09 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo