Now I am working on a ListView which retrieves data from a server, and each item contains images that needs to be renderred to an ImageView. According to my knowledge of Android, the network service should be bind/unbind for each network access, and the image to be renderred should be retained from an InputStream which comes from the network service.
Briefly, the scenario is like the android market app, which renders each app with their own logos asynchronically. How does the Market App make it?
I am now totally lost how to structure the code...
Would anybody kindly help to show some snippet that works?
Look into Asynchtask of android api.
Hope this help you
Related
I have an Android app that has a service that handle Firebase messages. So far it's working for me and I receive messages properly even when app is in background. What I need is somehow update app content when a message is received. That mean use network to contact backend and download fairly long JSON data and put them in database.
I have model in repository which I use in Activity. Now I am considering whenever I have to somehow call activity and refresh data but I think activity is somewhat dead when app is in background? So I don't know if it is even possible.
I can download data inside the service but my understanding of service is that it shall be lightweight and all the model and network calls seems to be a bit overkill for the service. Am I wrong?
What is ideal solution considering standard android architectural approach? Thank you.
I am working on a game - it requires to implement offer-Wall.
The problem is from within the game I am not able to display the offer-Wall.
My game at the time of loading the splash makes some connections (login, creating sessions etc) with own game server. Once this is done im not able to display the offer-wall.
If I Comment the in-game server connections the offer-wall works good.
And the offe-rwall being used is NativeX (W3i earlier)
But I could display the same offer-wall correctly from another test App.
Seems like Once the game is connected to the game server, no other connections are alowed Or they are put on hold. Any help with this please.
Thanks in Advance.
The NativeX MonetizationSDK requires initialization on the UI Thread.
Make sure that after you are making the network calls to your server you get back on the UI Thread before initializing and calling the SDK.
I am having one web service in which i have list of countries, state and corresponding cities of it. Now I am little bit confused in pulling this data in my Android app. Right now I have only 2(USA,Canada) Country data with me but it might be increased in future. Also I have list of state in this country and yes the cities in every state.
I have one splash screen in my app in which I have written the logic of getting country and on the basis of that i am getting state and then cities for every state. But its long process and if i publish this a user will be frustrated by waiting time. So I don't want to use this way which takes longer time for pulling data. Is there any other way or suggestion for me to achieve this.
All suggestions are welcome.
you should use AsyncTask to perform any web data downloading (and uploading), it works in the background and does not block UI thread, so your user won't notice.
also, it might be a good idea to supply default country/city data along with your application and then download only changes/updates.
Use a Service or intent-service, to download the data in background. and when the download is complete you can display the downloaded data using onbind. service runs on a seperate thread.
You could simple use the system DownloadManager to get the files from your sources and later process them. The DownloadManager will even inform you when the file is fully downloaded.
Take a look a https://github.com/commonsguy/cw-android/blob/master/Internet/Download/src/com/commonsware/android/download/DownloadDemo.java for a simple example code using DownloadManager.
Warm greetings.
I am quite new to android currently & had fallen under a fix. The concern is i am running the app which performs multipart upload to a remote uri using HttpPost, if the upload fails, the data is then saved to sqllite.
Now as soon as the application starts my app firstly queries the db & if there is any unsent data it first send it then proceed ahead.
What i am looking for is a feature via which i can run this task in background, i can not place this peice of code in onPause because i have few other intents which give a call to Camera, image viewer, gps etc... Any suggestions how can i manage this & how can i acheive this. Is there any samples/links available for implementation like this.?
PS:- I have the application with one single Activity defined in Manifest, other are the inbuilt Broadcasters like Camera Intent, Media Player etc. Just an additional info
Any help will be highly appreciated.
It sounds like you need a Service: http://marakana.com/forums/android/examples/60.html
Please check below link for executing the task in bg.
http://developer.android.com/reference/android/os/AsyncTask.html
I creating a small application that will basically use a background server to send data over HTTP. I dont know how to create services. Secondly there will be a couple of activities in my application. I want the activities to display a Context Menu when data becomes available. How can i do both. I have search for a while but the code i keep getting dose not seem to run on 1.6 api. How can i create the service and how can my activities listen to updates so that when a update is available they display a message.
NOTE: I do not need help on the HTTP part and the server part only creating the service and my activities listening to updates.
Kind Regards,
Give the Service docs a very good, thorough read.