Android :: No Network Connectivity In Service/AlarmManager Process

Mar 24, 2010

I have a Service/AlarmManager set to go off ever hour; as seen at: http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices...

The Alarm triggers a Socket connection to communicate with a Web Server. I'm logging the interaction to a file so I can see it later. When I leave the phone on my desk for a day, it seems that more often than not I get a "Network unreachable" error when trying to do any networking.

I believe it is related to how deeply the phone goes into sleep. Is there a special kind of lock I have to hold, or some command required to prep the wireless radio so that it can be ready to access the Internet?

Android :: No Network Connectivity in Service/AlarmManager Process


Android :: Remote Process - Service Fetches Data From Network

Sep 15, 2009

I needed to call a remote service. The service basically fetches data from the network. I am bind the connection once,and then I unbind the connection when the user is no more in that page. Everything works fine.Except that when I call the sa,e remote method for 17th time,it just does not call the service at all.It neither throws the DeadObjecti Exception. I have run out of ideas.Is there anything that I may be missing.

View 7 Replies View Related

Android :: Remote Service Process Persists - I.e. Won't Disappear From Process Table

Feb 21, 2009

At a certain point in my program, when I'm completely done with my service, my activity executes unbindService() and stopService() -- yet the process persists. I can tell that it persists because I run "ps" in "adb -e shell":

CODE:.............

"adb logcat", I can show you the sequence of events:

ACTIVITY: context.unbindService(serviceConnection);

SERVICE: onUnbind();

ACTIVITY: stopService(serviceIntent); & returns true!

SERVICE: onDestroy();

First, my activity calls unbindService(serviceConnection). According to the documentation, unbindService() will "Disconnect from an application service. You will no longer receive calls as the service is restarted, and the service is now allowed to stop at any time." So that is fine, and it is happening.

Appropriately, we see the onUnbind() call happen on the service side. According to the documentation, onUnbind() is called when "all clients have disconnected from a particular interface published by the service." So this confirms the correct service connection is being passed, and that the service is responding accordingly.

Next, my activity calls stopService(serviceIntent), and returns true. According to the documentation, stopService() does the following: "If there is a service matching the given Intent that is already running, then it is stopped and true is returned; else false is returned." Again, this is happening and returning true.

In response, the service's onDestroy() method is called. According to the documentation, onDestroy() is "Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead."

At this point I expect the process to disappear from the process table. Yet it remains indefinitely. But why?

Also, the process is so persistent that I can bind to it again, and I see that it is the same exact process responding because the PID (process ID) is the same!

View 4 Replies View Related

Android :: Using AlarmManager As Timing Service

Jan 19, 2010

I wanted to ask a question regarding the Alarm Manager. I have a requirements of setting long running timers in my application. The minimum duration for my timer is 1 hour...and the maximum may be for 4-5 days. This timer is supposed to run in the background, and when it fires/expires, i have to show something on the GUI. The timer can be re-scheduled once it fires based on user action.

What is the best approach for scheduling such long running timers ?

Should i make use of the Alarm Manager ? Or will it be an overkill ? As far as i know, alarms are retained even if the device goes to sleep and they wake up the device when the alarm goes off.

I am thinking of using a simple Java TimerTask as an alternative to setting an alarm: http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html.

But i am not sure what will happen to the timer task if the device went to sleep while the task was running.

View 5 Replies View Related

Android :: AlarmManager Starting Service - API Level

Nov 10, 2010

I've read comment that the AlarmManager in a earlier API version couldn't start services. Prior to which API Level was that?

I'am currently testing in the emulator with API Level 4 and it start a service just fine.

View 10 Replies View Related

Android :: Way To Use AlarmManager In Droid To Launch A Daily Service?

May 30, 2010

I need to run a service each night at midnight. I would like to use the AlarmManager to do this. Can you give me some guidance of how to make it work correctly?

View 1 Replies View Related

Android :: Tips On Making An Android Service / Which Polls Web Service Handle Bad Connectivity

Jul 16, 2010

I am developing an Android app which needs to poll a specific webpage in time intervals. I've got it to the point where it does indeed poll the page on a specific interval, and that interval is specified in a SharedPreference which can be changed by the user in the settings page of the app. But complications arise when network connectivity is flaky.For example, how do I ensure that the Service "wakes up" the network adapter and gives it ample time to connect before polling the page, in the case that the phone was sleeping to save power? This polling action can happen as little as once every 24 hours, so I don't want to miss one action just because the network was out (but turned on a few seconds, minutes, or even hours later).

Or there are times when the web service doesn't respond, or DNS doesn't respond, or what have you, and for any reason it doesn't get a response even though the phone is technically connected. What sort of rule do I put in place to make this retry later, so that I'm not retrying repeatedly when the user specifically turned off their internet but I'm retrying soon enough that if it was just a hiccup, the data can be received soon after the first try?Are there any examples for this type of situation? What is the logic to best handle this?

View 1 Replies View Related

Android :: CDMA 4G Network Connectivity?

Oct 30, 2010

My app doesn't connect through HTC EV0-4G. How app can access network through CDMA 4G.

View 1 Replies View Related

Android :: Network Connectivity In Java

Nov 17, 2010

I have a simple java code which gets html text from the input url:

code:................

I am using this code in an android project. Now the problem comes when there is no internet connectivity. The application just halts and later gives error. Is there some way to break this after some fixed timeout, or even return some specific string after an exception is thrown.

View 4 Replies View Related

Android :: Checking For Network Connectivity?

Oct 6, 2010

I have an IntentService which makes some web service calls. Before making these calls I check to make sure the device has network connectivity.

I am doing so like this:

CODE:.............

Unfortunately, when I'm debugging on my Android device, this returns false when I have both a network and a wireless connection.

Some interesting tidbits about connec.getNetworkInfo(0):

CODE:...................

Clearly this code is not sufficient (perhaps it would only return true if I sent some bit over the network and turned the radio on?). Moreover, since I'm not well versed in the ConnectivityManager, I'm assuming I should probably be scanning all networks (ie: getNetworkInfo(0 through N)).

View 1 Replies View Related

Android :: Network Connectivity Checking Without Wakelock

Mar 26, 2010

I have a terrible bug in my widget. The widget is waken up using an AlarmManager (the update interval is chosen by users, ranging from 30 mins to 2 hours) to grab some data from the Internet and display it on the widget. I do not hold a wakelock since if the phone sleeps, just let it sleeps. There's no way to update the information since nobody will see it. If I put the phone in the basement (has no wi-fi or cell signal) for about an hour. the phone will definitely not update anything. However, when I get it back from the basement, the cell network could never be recovered again no matter how long I have waited (it just get an X on the cell signal icon on the notification bar) that I must restart the phone. May I know if a partial wake lock must be held on checking network availability?

Find the code skeleton as below:

CODE:.................

View 8 Replies View Related

Android :: Service To Check Internet Connectivity?

Jun 29, 2010

I want to create an Android service, which notifies the main activity whenever disconnects and when internet reconnects again. I have following function for checking internet connectivity:.

CODE:...........

But I want to know, how to use it in a service.

View 1 Replies View Related

HTC Incredible :: No Network Internet Connectivity

Apr 29, 2010

So I dropped AT&T for the Incredible and my number successfully ported over, but I cannot connect to the Internet.I can make/receive calls and SMS, but no Internet besides wifi.I've been on with vzw support and went through reactivating the phone (*228) and a couple hard reset to no avail.They said it could have something to do with porting from AT&T, but I'm not understanding that connection.I don't have too much faith in support figuring out so I'm trying this forum. Does anyone have a clue how to resolve this or is it a defect with the phone.Some details: there is no 3G symbol near the signal status bars.Settings/Wireless & networks: shows "Mobile Network" with a green check, buts its grayed out so no action can be taken on it.Directly underneath "Mobile Network" it says "Turning on..." and it seems to flash that status every once in a while.

View 5 Replies View Related

Android : Read Only Time - Locally Without The Involvement Of Server Or Network Connectivity

Feb 12, 2010

I would like to implement a functionality in my game to give some daily goodies. But user can easily abuse it by changing the date of the device again and again. I know this can be easily implemented through some server. Is there any way to handle it locally without the involvement of server or network connectivity?

View 2 Replies View Related

Connectivity State In A Service?

Jan 16, 2012

I am trying to find a way to get the connectivity state in a service, found the code below but getSystemService is red underlined.

public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE );
return cm.getActiveNetworkInfo().isConnectedOrConnecting( );
}

View 2 Replies View Related

Samsung Epic 4G :: No Internet Connectivity / Network Settings

Nov 14, 2010

My Epic 4G just lost all connection to the internet about an hour ago. Out of the blue, so to speak. I was browsing, set it down, then when I used it again it wouldn't connect. My browser, facebook, and any other connection required apps throw error messages saying - "connection error", "no connection". I've reset the phone several times, and as far as for the network settings, everything looks set the way it always is. I have done nothing to the network settings/options to have accidentally messed it up myself. I am connected via 3G, and this network problem is new to me. This phone has been nothing but constant problems and this is the newest one in a long list.

View 2 Replies View Related

Sony Ericsson Xperia X10 :: WiFi Connectivity Setup / Phone Cannot Find Network

Aug 11, 2010

I bought my Xperia x10 mini yesterday, and one of the first things I did was to set it up for WiFi in my house (which I already have 2 laptops and a stationary PC connected to). Setting it up was easy and quick, but my phone doesn't find the network, not even if I am standing right beside the router. I have tried to restart the WiFi connection, restart my phone, delete and re-add the home connection, but the phone still doesn't connect to the network.

The network's SSID isn't broadcasted for security reasons, could this be the problem? When I search for networks, it doesn't find any 'unnamed' networks like the windows pcs do. (which is normally the one I need to connect to.) Is there something wrong with my hardware? Or my software (my phone is completely up-to-date)? (Except broadcast the SSID, which is not an option..)

View 3 Replies View Related

Android :: Application Service Ever Run In Different Process?

Apr 26, 2010

If an application begins a Service via bindService or startService, will this Service object ever run from a process different from that of the application? I ask because many Android example projects begin a service and communicate to them using IPC which seems wholly unnecessary considering that, according to the Android Service documentation, "... services, like other application objects, run in the main thread of their hosting process." IPC, AIDL, and the IBinder interface only seem useful if connecting to a Service started by an application other than your own. Is this a correct or fair understanding?

View 1 Replies View Related

Android :: Process Down After Loadlibrary In Service

Apr 1, 2009

I need to load a .so library in my Service onCreate method, but the process just down after System.load. On the other hand, the same code can work in Activity. Are there some differences between activity and service in the way of load .so file.

My code class AisoundService extends Service

CODE:......................

View 3 Replies View Related

Android :: Singleton In Different Service Which Share Same Process

Mar 25, 2009

I have two services, both of them lies in separate apk, which run in same process. The two service share same jar file by <uses-library> method. The jar file implement a class, say "test", is a singleton. But I found that two instance of test is created under this case, could anybody give me some tips? I want to ensure it's singleton. Code...

View 8 Replies View Related

Android :: Show Dialogs In Service Process?

Feb 5, 2009

I intended to show a dialog in a service process, then I tried to use the AlertDialog but got the below error message: WindowManager$BadTokenException: Unable to add window -- token null is not for an application The reason seems to be that the dialog is not used in a application context (activity should be fine?) Was there any way that can solve this problem?

View 2 Replies View Related

Android : Check The Foreground Process From A Service

Aug 20, 2010

Does anyone know how to, or if it's even possible to check the (foreground process/top of the activity stack) from a service?

View 20 Replies View Related

Android :: Design Considerations - Sync Process And Using Service

Sep 29, 2010

I'm designing an android app which will need to do the following steps:

1. User pushes a button or otherwise indicates to "sync data".
2. Sync process will use rest web services to move data to and from the server.
3. The data will be stored locally in a sqlite database.
4. The sync process should provide status updates/messages to the UI
5. The user should not be allowed to wander off to other parts of the application and do more work during the sync process.

The first time the sync process runs, it may take 10-20 minutes. After the initial sync, less data will be transferred and stored and I expect the process to take 1-2 minutes or less. I've been doing a lot of reading about android's AsychTask and various examples of using a Service. But I don't fully understand the design considerations and trade-offs of choosing one design over the other. I currently have my demo project stubbed out using an AsychTask. After watching (most of) Developing Android REST client applications:
http://code.google.com/events/io/2010/sessions/developing-RESTful-and...
I'm left confused the design patterns described here feel overly complex, perhaps because I just "don't get it" yet.

View 19 Replies View Related

Android :: Signal An AppWidgetProvider From Service Running In Another Process

Feb 2, 2010

I am attempting to signal my widget such that it receives my new Intent from my service

The code I am using to send from the service is as follows:

CODE:...........................

View 2 Replies View Related

Android :: Inter-process Communication With A Service And Notifications

Dec 13, 2009

I'm having an issue with inter-process communication with a Service and Notifications

The structure of my application is as follow: - ListActivity (TunnelDroid), once the user presses a listitem it will start a Service. The ListActivity is binded to the service for intra-process communication

- Service (TunnelManagerService): running in the background. This service will add a (permanent) Notification in the statusbar. Using a Handler I sometimes need to communicate with the ListActivity (to show GUI Dialogs)

- Notification: Once this notification is clicked it should open the ListActivity.

To add the action when the user touches the notification I use the following code: notificationIntent.setClassName("net.sourceforge.tunneldroid","net.sourcefo­rge.tunneldroid.TunnelDroid"); Then I use the intent to create the notification.

Unfortunately a new Intent is opened. When I press the back button the original ListActivity is shown. So I have two instances of my same class/list.

How could I make sure the original ListActivity is opened when the user touches the Notification?

It's OK for me if the original ListActivity was previously destroyed, but I cannot have two instances. The problem is that the Handler in the Service has a reference to the ListActivity (PARENT_ACTIVITY), so if another instance is created I have invalid references. I could overwrite the PARENT_ACTIVITY, but then when the user presses the back button I have an instance with no correct link to my Service resulting in a crash/nullpointer.

The complete source can be found here: http://tunneldroid.svn.sourceforge.net/viewvc/tunneldroid/tunneldroid. Attached you can find a drawing of (most of the) inter-process communication. Could someone point me in the right direction?

View 3 Replies View Related

Android :: How To Establish A Two-way Communication Between Activity And Service In Different Process

Mar 19, 2010

I'm working on establishing a two-way communication between an Activity and a Service which runs in a different process.

Querying the process from the Activity is no big deal. But I want the process to notify the Activity on events. The idea behind it is this: the service runs independently from the actual app. It queries a webserver periodically. If a new task is found on the webserver the process should notify the activity.

I found this thread over at AndDev.org but it doesn't seem to work for me. I've been messing around with BroadcastReceiver. I've implemented an interface which should notify the Activity but the problem is that the listener is always null since the Broadcast from the process is done via Intent, hence the class that extends BroadcastReceiver will be newly instantiated.

How can I establish a 2-way communication? This has to be possible.

View 3 Replies View Related

Android :: Automate Process Of Publish Droid App / Google Have Web Service To Do That?

Nov 10, 2010

We have several Android apps and found that the process of uploading apps for each release via Android Developers website slow and ineffective. We like to automate the process. To be more clear, we have automation for compiling and building the apps, it's a matter of uploading them to Android Market and fill in the app details for publishing. This is where we are left with manual publishing.

I am interested to learn how people automate the processing?

Does Google have a web service of some sort for publishing Android App on Android Market?

View 1 Replies View Related

HTC Hero :: Tracking Process Responsible For Network Traffic?

Aug 6, 2010

Anyone know an app that will tell me which apps/processes are responsible for the network traffic on my hero. I already have net counter for the overall amount, just looking for an app to track by process.

View 2 Replies View Related

Android :: Keep Broadcast Receiver Process Alive / By Creating Service That Stays Around?

Sep 16, 2009

The app widget documentation indicates that the "widget provider"being a receiver of a broadcast service may not exist (the process) beyond the completion of the call.If I want to maintain state between two broadcast events, such as say widgetProvider.onUpdate(), can I start a local service and leave it hanging there until my widgets are disabled? If I didn't explicitly stop that service will it be loaded again and resumed when the device wakes up.

View 4 Replies View Related

Android :: Resulting Thread Id Scoped Per Process / Current Activity / Service?

Jul 21, 2010

When you do a Thread.currentThread().getId(), is the resulting thread id scoped per process or scoped to the current Activity/Service?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved