Android :: Network Service Need To Return Callback

Oct 6, 2010

if the service dies, and i know it can during request processing, it's an issue for me, first i've seen it, the process wont die until the net request returns (then the thread dies gracefully), unless kill -9 is used on the process... then i'm not sure what android does with the connections. I'm not sure what's the approach i should take here.(it will be true though even if this was a local thread and not a service)if i want the service to listen on a callback and call it once the network processing is done, i'm in a problem, no instances can be passed on using Intents.

So i need some other solutions, all the ones i though of sounds bad to me: A. use IBinder to get instance of the network service class then i can call one of it's methods and pass on an instance, this will work since they all run in the same process, BUT requires me to use Async way to get a Network instance which is not so suitable for me. B. Use static member in the Service i can access, then what to i need the service for ?. use intent to send parameters only to the service, the service will compose a Request out of it and put it in the queue, then once done will send a response using intent which will encapsulate the response (which might be long!) and will also contain the name of the calling class as a string so all the Receivers will know if it's for them or not - BIG overhead of encapsulating data in Intent and search in all the receivers for the right one to get the response.I don't want to use the service as a local running simple thread since i'm afraid if i'll run it in the root activity i will have to use static container so it will be visible in each activity and if the root will be destroyed for some reason it will take all the service with it, even if i start new task and the process is still alive.Anyone got some nice ideas on how to approach this thing ?

Android :: Network Service need to return callback


Android :: Service Callback To Activity

Jan 13, 2010

Our application will expose a Service that can be called by Activities in other people's applications.In many cases, the parent applications calling Activity may be paused before our Service completes. I am looking for the best way for a Service to communicate back to the calling Activity that may have been paused.These are the known options:

(1) Require calling Activities to have a registerReceiver() with a custom action and broadcast to that from our Service. The only way to secure this registerReceiver() is with a signature-based permission.As our Service communicates with any number of unknown 3rd party apps,we can't sign our Service's parent app with all these unknown certificates. These apps would therefore be exposing an unsecured registerReceiver() on their Activity. Would ideally like to avoid requiring this.

(2) Create a PendingIntent to send results back to the activity and give it to our Service. Our Service would send data to calling Activity's onActivityResult(). Each time the result is delivered, the calling Activity will go through onPause() and onResume() but this should be OK.

(3) The calling Activities could create a Handler. The Activity would then create a Messenger pointing to that Handler and send it to our service. Our Service can then use the Messenger to deliver our message back to the calling Activity.

View 2 Replies View Related

Android :: AlarmManger Service Callback To Main Activity

Oct 30, 2010

In my application, there is a service which has a running thread to capture data from remote server, and also this service is triggered by AlarmManager, for example let 1:00 am to start the service. After the service finish the task, it stop itself and the main activity need to update GUI. I don't know how to let the main activity know when the the service stopped, so that the main thread can update GUI.

View 3 Replies View Related

Android :: Dialog Callback From Withing Callback?

Aug 28, 2009

I'm trying to pop up an AlertDialog when someone long presses a list item.What I end up with is nested callback objects.I'm not sure if that is the problem but simple Alert dialog examples are not working for me.

View 3 Replies View Related

Android :: How Does Service Return Result To Activity

Oct 1, 2010

i seem to have a classic task, yet i can't find any examples on how to do it.i want to download something. well i call a web service and get a response but its pretty much the same.in order to do this i have an activity that starts a service that spawns a thread that does the job.now i would like to use the data i got in the activity that started the service.(i assume that starting another activity to handle the job of displaying the result would be simple)my problem is how does the service notify an activity (the one that started it or another one) of something.

View 1 Replies View Related

Android :: How Can Service Return A String Back To Activity?

Nov 11, 2010

I am new in Android. I encounter the following situation, I have a background running service, which will get a keep-updating string from a webpage, I need to show this keep-updating string in my UI through Activity, since this string is get from service, I am wondering, How can the service pass the string to Activity so that activity can render the string on UI.

View 5 Replies View Related

Android :: Strange Error With Return String From Web Service

Aug 13, 2010

I have a strange issue. I am using KSOAP2 to create a soap request to a .net webservice. I do this in a few other places and everything works fine. The webservice basically queries a data base and takes the values from the data reader and creates a string. This string is then returned. When I run the webservice on my local machine(Without using android) it works fine. When I run it from the webserver (still not android) it works fine. When I call it from my phone however the line: String hazards = (String)envelope.getResponse().toString () ; //Get response from .net Web service Simply is filled with anyType{}. Now if I go to the webservice and I manually type in the contents from the database to represent what the string concatenation should be it works perfectly. The line: String hazards = (String)envelope.getResponse().toString(); //Get response from .net Web service Now returns the string value i need. Does anyone have any idea why this is happening or know a better place to ask this question?

View 4 Replies View Related

Android :: Return ArrayList From .net Web Service To Droid App Using KSoap?

Jun 9, 2010

My web service is returning quite a bit of data, so i'm storing it in an arraylist and returning that to my application. I don't know whether or not this is the preferred method or not. When the arraylist is returned and displayed in my application, it also displays the arraylists "anyType" section. I'm new to this whole process so i'm sure i'm missing something somewhere or going about this incorrectly. Can anyone point me in the right direction please?

View 2 Replies View Related

Android :: How To Test IBinder Object That Service Return On OnBind?

Apr 27, 2009

How to test my IBinder object that Service return on onBind ?

View 1 Replies View Related

Android :: Need A Sequence Of Initialization Of Network Service Provider

Mar 16, 2009

I am trying to make the use of Network location provider to get the location updates, But it seems to be that Network location provider makes use of MASF client . From the debug statements we found that Network provider does seems to launch MASF client , Would some one explain me the basic sequence of initialization of Network service provider ? and if MASF client is not getting initialized do we need to do some settings. What do i need to check .Any information on this is Highly appreciated.

View 2 Replies View Related

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?

View 21 Replies View Related

Android :: Want Block Service Like Network Of 3rd Party App In Droid?

Oct 29, 2010

I want to block access to any service like Network for particular 3rd party application.

For e.g. Email app, I want to block network usage form my application.
or any game or app using network for advertisement, I want to block access to network for that app

so how can i get permission list and block permission from my application?

eg i want to change permission of app A by app B.

View 1 Replies View Related

Android :: Network Time Not Auto Updating With Some Service Provider?

Sep 9, 2010

I am facing problem in Froyo (Android 2.2), Network Time is not auto updating in date and time setting (using NITZ when Automatic option is enable) with some Service provider (Like BSNL and Reliance). but it's working fine with Vodaphone and Airtel. And i observe based on LOG statement that Unsoliciated Command UNSOL_NITZ_TIME_RECEIVED is not getting called at the time of Android system boot-up time with some Service Provider (like BSNL, Reliance) but it's getting called when i insert the Vodaphone and Airtel SIM card. but not able to figure out that How this UNSOL_NITZ_TIME_RECEIVED command has been triggered? If anybody have any idea please help me? Also i willing like to know where i have to made change, is it in Kernel level or Framework level?

View 3 Replies View Related

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 :: How To Change Network Service Permission Without Modifying Init.rc File

Nov 8, 2010

I have a requirement to change network service permission(such as netd to 660 or something similar) for my application in order to access certain features. I dont want to edit init.rc file to make such changes. Since my application cannot be run in root mode, is there any alternative solution where i could do such modifications from my application point of view.

View 6 Replies View Related

Motorola Droid :: No Service And Says Not Registered On Network

Nov 9, 2009

So all of a sudden I have no service and it says not registered on network!

Just happened, I was browsing apps and boom! Has this happened to anyone else?

View 8 Replies View Related

General :: No Service And Error While Searching For Network - GS4

Oct 2, 2013

I have a S4 (SGH-I337M) with Android 4.2.2 installed on it, Not Rooted, Not unlock. I can't access to mobile service network, my SIM card works with other phone, but when i plug it in my galaxy s4 it detect network for 2 ou 3 seconds then it turns to No service and than detect for 3 seconds and ... so on. i have tried to search for available networks (setting-> other network -> mobile-> search for networks) it displays error while searching for network.

I tried many options, reboot, filght mode on-off, recovery, reset, and nothing worked.

View 3 Replies View Related

General :: Galaxy S4 - No Mobile Network Service (3G / 4G Not Working)?

Jul 1, 2013

I just got my Galaxy S4 today, and decided to turn off Wi-Fi so I can see if 3G works. I have a bunch of bars, but every time i try to use something that requires an internet connection, the phone says im not connected. I dont even see a menu to turn on 4g and 3g like my Evo 3D had.

View 4 Replies View Related

General :: Galaxy S4 - WiFi And Network Service / Fail To Obtain IP

Sep 28, 2013

I have a S4 (SGH-I337M) with Android 4.2.2 installed on it, Not Rooted, Not unlock. My problem is with the WIFI and Network mobile serviec (GMS, 4G).

1. when i turn the wifi on, it gives me fail to obtain IP, and at the same the mobile service detected my Mobile Network (Rogers) for moment then it turns to No service for few moment to come back to Rogers an other time and so on( like infinity loop between Service detected and No service).

2. usually when i turn off the WIFI, the phone goes to look for 4G network but this doesn't happen now, and still Mobile Service between detected and Not.

3. What has been said until now is with SIM card On. and i tried to take it out the phone and turn the phone on, and the same problem is still with Mobile Network service but now the infinity look (as I like to call it) is between No service and Insert Sim card, at the same time can't access to the WIFI (Fail to obtain IP).

i have tried several thing to solve problem : like changing the SIM card, Reset phone to factory setting, turn it off for while and open it, but the problem still excite.

it seems that it is software problem but i don't know which process responsible of Network Service setting (WIFI, 4G, GSM) so i can stop it and lunch it again.

View 10 Replies View Related

HTC EVO 4G :: 30 Day Return Policy - Out Of Stock At Return?

Jun 27, 2010

If I need to return my phone before the 30 days are up and they are out of stock, will they still honor the return policy and just call you when they have one available or will you have to stick with the phone that you have?

View 5 Replies View Related

Android :: Why Don't Get My OnContextItemSelected Callback

Aug 28, 2010

I am implementing a context menu for my main activity.

I have some XML to define the items:

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

I have this code to create the menu:

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

When I click the menu button, my context menu appears with the appropriate items and icons. When I select a menu item, I don't get the callback.

View 1 Replies View Related

Android :: GPS Callback Off UI Thread?

Jul 6, 2010

I'm having trouble getting the GPS's onLocationChanged to run on a different thread. I understand how to manage UI thread when I'm calling a function but with the GPS, I don't actively call the function.

My intent is to have a light flash every time the GPS receives a reading. I have put this function in a Runnable. I passed this function to a class that implements LocationListener. Then in the main class, I started a new thread that calls requestLocationUpdates. I was hoping that onLocationChanged of the LocationListener would run in a different thread, post to the callback and make the necessary UI effects in the UI thread. Unfortunately, the program crashes every time it tries to call requestLocationUpdates. What's the proper way of doing it?

Right now it looks something like this

Main class:

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

LocationListener class:

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

The exception says Can't create handler inside thread that has not called Looper.prepare()

View 3 Replies View Related

Android :: What Is A Binder Callback

Aug 31, 2010

I have been watching the Google I/O presentation by Virgil Dobjanschi on the correct way to implement REST on Android with services and content providers. http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html

Based on the video I'm doing things the wrong way, which is not surprising given how hard the right way is. Anyway, having been shown the promised land in the video I'm having a bit of a problem figuring out how to get there.

I have most of it nailed but the one thing that's defeating me is the Binder Callback that Virgil references in the slides (see link above), on page 43 it shows step 2 as starting the service with startService( intent ) and step 10 as returning status information using a Binder Callback. There is no example code anywhere in the presentation which is rather frustrating. There is talk of open sourcing the Twitter client which apparently uses this approach but nothing yet and the announcement was in April.

In the video he states: "What is a binder callback? A binder callback, think of it as an interface that was passed in the request intent."

I have searched all over the place but have not been able to find any doc or examples that show how to pass a callback as part of an intent. Nor can I figure out any other way of passing in a callback.

I thought he may be referring to binding to the service and implementing the callback that way. However, he is specifically referring to a local service and using strarSerice() and not bindService(). Also with bindService() the service will be destroyed if the activity is destroyed which defeats the idea. The workaround is to use startService() and then bindService() and leave the service running for the duration. The other problem with bindService() is that the callback can not be use until onServiceConnected() completes which complicates the code even further as the action instructions can not be passed in the intent because the return callback may not be in place in time to return the results.

View 1 Replies View Related

Samsung Galaxy S : Use Internet Service Says Unable To Connect To Internet/network Unavailable

Oct 17, 2010

I'm having a problem with my internet connection on my SGS. It used to lock to T-m*bile, I unlocked it lastweek then use L*bara instead cause got free internet service hehe. somehow, everytime i try to use internet service it says unable to connect to internet/ network unavailable. but I tried the simcard with another phone and it was working. some friends suggest me to re-unlock it. but i donno how to re-unlock it.

View 2 Replies View Related

Android :: Android To Open Network Connection On Specified Network Interface - Network Type

Mar 6, 2009

I have been looking at the ConnectivityManager class documented at http://developer.android.com/reference/android/net/ConnectivityManage... .

I would like to know if an Android application can open a network connection (socket) on a specified network interface [on a device supporting multiple network interface types WiFi, Cellular, WiMax etc] ? I am looking for the capability for an application to open a socket on a given type of network for example over WiFi network or over 3G Cellular Data network.

If this is possible in Android, how would I code this requirement within the API Framework ? The ConnectivityManager enables an application to learn about available network connections and currently categorises them as either TYPE_WIFI or TYPE_MOBILE.

There is a member function in the ConnectivityManager class called requestRouteToHost(int,int) [url] which "Ensure that a network route exists to deliver traffic to the specified host via the specified network interface. An attempt to add a route that already exists is ignored, but treated as successful." Sounds like this would install an IP routing table entry to reach a given host via a specified network interface type (WiFi or Mobile). After calling this would it be sufficient for an application to open a socket and connect to the desired destination address ?

Or perhaps the application needs to bind() a socket to a local address of a network interface of the desired type (WiFi or Mobile) Or by setting a socket-level socket option of SO_DONTROUTE ?

View 2 Replies View Related

Android :: Defining A Callback Function For A Given Value

Sep 13, 2010

In Java, is it possible to associate some object (i.e. a String) with a function to be called ? I have two similar menus and both have a onClickListener with some code like this: Code...

View 4 Replies View Related

Android :: Manage The Callback Of The Applications?

Apr 2, 2010

in android application development, i frequently go through the word "CALLBACK" in many places. i want to know want it means to tell us technically. and how i can manage the callback of the applications.

View 2 Replies View Related

Android :: OnItemClick Gets Called As Callback?

Dec 31, 2009

Could someone please shed the light as to where onItemClick() function gets called as callback when I click on the item of a ListView?

In core/java/android/widget/AdapterView.java:

onItemClick() belongs to the interface OnItemClickListener of AdapterView.

The listener is set through setOnItemClickListener() of AdapterView.

The listener is only invoked in performItemClick() of AdapterView.

The listener is also invoked indirectly in performItemClick() of ListView.

But, I still don't know where exactly onItemClick() of the listener will get called when I click on the item of a ListView. Logically it should be like:

device -> kernel driver -> dalvik VM -> my app.

Could someone please tell me the exact code that calls onItemClick() when I click on the item through the device?

In this digital era, where computing technology is pervasive, your freedom depends on the software controlling those computing devices.

Join free software movement today! It is free as in freedom, not as in free beer!

Join: http://www.fsf.org/jf?referrer=4445

View 5 Replies View Related

Android :: Camera Callback OnPreviewFrame?

Nov 10, 2010

I am working on an application in Android and I have to manipulate the data coming from the preview.

I read that the default frame rate is 15fps. I measured the time from one call of the onPreviewFrame function and the next one and I noticed that I got different times depending on the size of the preview (at the moment no other operations are done in this function). How can it be possible? I thought it would be called at any frame so 15 times in a second (approximately every 66ms) independently of the previewFrameSize.

View 2 Replies View Related

Android :: OnSharedPreferenceChangeListener Never Receives Callback

Jun 15, 2010

I'm trying to listen for preference changes from an activity (see below). It never fires. Is it due to the fact that the activity in question is not in focus when the change event fires?

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

View 10 Replies View Related







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