Android :: How To Pass Complex Data Structures Between Service And Remote Binder?

Feb 17, 2010

The object passing between an Android service and the remote binder is happening through serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?

Android :: How to pass complex data structures between service and remote binder?


Android :: Complex ListView Example With Complex Data / Layout Of Each Row?

Feb 16, 2010

Im pulling a list of product objects from a database call and I want to build a ListView of the data in my activity with a non-scrolling header and footer. Each row will consist of a product thumbnail, some data and a button arranged horizontally. I understand that using the ListView I can inflate each row using a separate layout. Most of the examples Ive seen using ListView just show a simple array of strings that fill the whole view of the activity, but most real-world examples will be more complex and I can't find any good examples that explain how all these pieces fit together. Does anyone have any pointers to sample code with a good explanation ?

View 2 Replies View Related

Android :: Pass Data From Activity To Service Using An Intent

Jul 20, 2010

How do I get data within an Android Service that was passed from an invoking Activity?

View 1 Replies View Related

Android :: Pass Complex Objects Between Activities

Oct 18, 2009

I am trying to pass a user defined object to another activity Bundle bundle = new Bundle(); bund.putSerializable("myData", myData); intent.putExtra("bundle", bundle); where myData class implements Serializable interface. I am getting following error: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object how to pass complex objects between activities?

View 7 Replies View Related

Android :: Pass Complex Objects With Help Of Intents?

Nov 18, 2010

I am trying to extend the "android.content.Intent" class by adding a private attribute of a custom class. My goal is to send complex objects from the main Activity to a background Service.
The extension itself is not a problem, the class gets compiled without any errors and the project runs. The only problem is that the BroadcastReceiver does not receive the modified Intent and the "onReceive" method gets never called.
It there any way to pass complex objects with the help of Intents?

View 1 Replies View Related

Android :: Unable To Get Data From Activity To Service / How Intents Could Pass That?

Nov 24, 2010

I am pretty new to this but I was told I could get good help here. A friend and myself are playing around with creating Android apps (using ADT)

Here is how we are trying to make the program: in activity, user sets threshold values for the X and Y axis on accelerometer. When user hits button "Start", startService is invoked and starts TiltService.

TiltService is designed to run in the background always on the phone without user interaction. TiltService constantly compares the threshold with the accelerometer values and will vibrate if they are off.

My problem is I can't seem to get the putExtra() data correctly. I have overridden the onStartCommand in my service but I get the message "unreachable code" when I save the getExtras() to a bundle.

Here is the relevant code (I can post the whole thing, just do not want to clog up page) code...

I thought I understood the basic of how Intents could pass data, but I guess I don't. Is it obvious what I am missing?

View 2 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 :: Binder Is Leaked By Binding To A Service

Jul 30, 2010

I made a code for my understanding of Android Service class.

It has just a single Activity and Service in apk. Service is the same as the sample code of API reference as below: http://developer.android.com/intl/ja/reference/android/app/Service.ht...

A client side is an Activity based on the above sample, and just added the following code:

CODE:.......

My sample application has a check box which starts(binds)/unbind to the local service on a single process. The local service instance is created by every bind request (and destroyed by every unbind).

If I press the button repeatedly, then LocalService$LocalBinder is leaked!

The problem is not resolved even If I set an obtained binder to null (like below).

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

View 6 Replies View Related

Android :: Adding Native Binder Service Permission Error

Sep 10, 2010

What is the best way to add a new native service that uses Binder and can get past the service_manager.cpp restrictions on what users can add services? I have created a new native service that is similar to the MediaPlayer. I make the addService() calls to add the Binder service to the system. This worked fine when the service was started as root. I moved the new service to be started as the "media" user. Then I receive permission errors because of the table in service_manager.cpp where there is a check for users and allowed Binder services. Do I have to add my service to the table or is there some other way?

View 2 Replies View Related

Android :: Static Data Structures On Embedded Devices

May 2, 2010

I've started working on some Android applications and have a question regarding how people normally deal with situations where you have a static data set and have an application where that data is needed in memory as one of the standard java collections or as an array.

In my current specific issue i have a spreadsheet with some pre-calculated data. It consists of ~100 rows and 3 columns. 1 Column is a string, 1 column is a float, 1 column is an integer. I need access to this data as an array in java.

It seems like i could:

1) Encode in XML - This would be cpu intensive to decode in my experience.

2) build into SQLite database - seems like a lot of overhead for static access to data i only need array style access to in ram.

3) Build into binary blob and read in. (never done this in java, i miss void *)

4) Build a python script to take the CSV version of my data and spit out a java function that adds the values to my desired structure with hard coded values.

5) Store a string array via androids resource mechanism and compute the other 2 columns on application load. In my case the computation would require a lot of calls to Math.log, Math.pow and Math.floor which i'd rather not have to do for load time and battery usage reasons.

I mostly work in low power embedded applications in C and as such #4 is what i'm used to doing in these situations.

It just seems like it should be far easier to gain access to static data structures in java/android.

Perhaps I'm just being too battery usage conscious and in my single case i imagine the answer is that it doesn't matter much, but if every application took that stance it could begin to matter.

View 3 Replies View Related

How To Parse Binary Data Into Structures

May 15, 2014

I primarily do hardware and firmware design, but a new product my company is developing has the need for an Android app and since I have the most Android programming experience (which is extremely limited) that leaves the task to me. I need a little guidance figuring out how to do a few things so that I can get this app up and running. I already have a simple GUI to display some stuff, but what I need is a way to handle data.

I am trying to receive a 148 byte stream of data over a serial connection, parse it into a structure and display certain values from that structure. The data is packed in a struct that is sent from a micro controller and due to that it has a very specific layout (i.e. the first 8 bytes mean this, the next 16 bytes are this... ). In C, I can just declare a struct with those values and use the #pragma pack function to eliminate any extra spacing the compiler would otherwise inject for alignment purposes, receive the data and do a memcpy into the struct to write the data. It's not the safest or cleanest way to do it, but it takes very little time and if you do CRC tests to make sure the data received is valid it works like a charm.

Now to the root of the problem: How do I declare structs in Java? Is there a way to pack them tightly like you can using C? Once I've received the binary data, is there a way to parse it into the structure easily? These are the issues we hardware programmers face when dealing with Java...

View 2 Replies View Related

Android :: Pass Remote Interface (aidl) Throughout Activities?

May 13, 2010

I am developing an application using services and Remote interface. I have a question about passing the reference of my Remote interface throughout Activities. In my first Activity, I bind my service with my activity, in order to get a reference to my interface I use

private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder service) {
x = X.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
// TODO Auto-generated method stub
}
};

x being the reference to my interface. Now I would like to access this interface from another activity, I see two ways to do it but I don't know which one is the "proper" way to do it: passing x with my intent when I call the new Activity redo this.bindService(new Intent(y.this,z.class), mConnection, Context.BIND_AUTO_CREATE); in the onCreate() of my new Activity

View 1 Replies View Related

Android :: ListView With Complex Data Model

Oct 20, 2009

I'd like to map an Array of "complex" data to a ListView. In a very simplified form my data model would look like something like this:
Code...

View 2 Replies View Related

General :: Galaxy Grand Duos - Backup Apps With Data Binder Before Flashing?

Apr 9, 2013

I have installed many applications on my Galaxy Grand duos, with binding the applications data to External SD card (32gb), what will be the best practice to backup all the application and the data before installing another firmware? I don't have enough space on internal sdcard to unbind the application data.

View 5 Replies View Related

Android :: Save Data Structures In Android?

Sep 24, 2009

I want to store some data from structures like this:

...........................

I want to save it to an external file on the sdcard of my device so that other apps can read it (and users can open/copy it). I thought I should use a DOM parser because my data structures are not very big, but I find no tutorials or anything like that. Is there a better way to store this information? how to use the parsers in android?

View 1 Replies View Related

Android :: Local Service Vs Remote Service

Nov 9, 2010

I'm confused about whether I need to run my service in a separate process. What are the advantages / disadvantages of each?For reference I'm trying to create an App that uses a service to play [streaming] audio in the background. So which one is better for my use case?

View 1 Replies View Related

Android :: Does Service Have To Be Remote Service Or Can It Still Be Local?

Sep 30, 2009

i have an app that binds to a local service.I want to add a desktop widget that binds to the same service. does my service have to be a remote service or can it still be local?if it can still be local, how can I get at the local binder?

View 2 Replies View Related

Android :: Android Remote Service Doesn't Call Service Methods

May 28, 2010

I'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL.This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me?If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong.

View 1 Replies View Related

Android :: How To Pass String From Activity To Service?

Aug 30, 2010

On Sat, Aug 28, 2010 at 3:53 AM, Ravi Grandhi <grk.r...@gmail.com> wrote: > How to pass a String from an activity to a service?

View 2 Replies View Related

Android :: Using Remote Service From Other App

Sep 24, 2009

I've implemented remote service using aidl & it is working fine if I'm using its service from same package. But If I tried to use the service from other application it gives me error

As below:

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

View 3 Replies View Related

Android :: Pass User Define Object Between Service And Activity?

Aug 21, 2009

I define a class Rect and a aidl file as below. code...

View 2 Replies View Related

Android :: API Demo Remote Service Example

Sep 22, 2009

I am studying RemoteService example in Android's APISample. In the manifest file, it declares the service like this: My question is how can I specify the service to be 'auto-start', i.e. it gets start whenever the phone start?

<service android:name=".app.RemoteService" android:process=":remote" >
<intent-filter>
<!-- These are the interfaces supported by the service, which
you can bind to. -->
<action

android:name="com.example.android.apis.app.IRemoteService" />

View 1 Replies View Related

Android :: Remote Service - Reconnecting

Aug 11, 2010

I have implemented a RemoteService which will increment a countere ( just for testing purposes ). Therefore I have a Task class which implements Runnable and the method run() where a infinite while loop increments the variable.

From the client side, I start the RemoteService with startService and then i bind to the service. When I close the activity, the service is still running. Now i want to rebind to the service.

How do I know if the service has already been started (therefore i would only need to bind to the service again) or not (then I would need to call startService() first and then bind to the service)?

What would happen, if I call startService() if the service is already running? Does the OS start a second service, or will it affect the service which is already running?

View 5 Replies View Related

Android :: How To Execute A Remote Service

Jul 28, 2010

I have a service MyService.java in Application "ServiceDemo". The manifest of this application looks like this

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

I have another application "CallerService" manifest looks like this

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

I have an activity from where I m trying to start the service on the click of the button

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

This fails to work. Says "unable to start service intent"

View 1 Replies View Related

How To Pass Variables From Service To Activity

Aug 30, 2012

how can I pass variables from service to activity and vice versa?

View 1 Replies View Related

Android :: Activity Starts Remote Service

Oct 8, 2010

My initial activity is basically a splash screen while preforming initialization and login in to network server. To save memory I want to finish() the splash activity once it starts the main menu activity. I still want the remote service to operate. Testing shows it does. But am I going to get into trouble doing this? I know I can restart the remote from the main menu activity but I am trying to save overhead by not starting it twice. The remote service is required by the splash activity.

View 1 Replies View Related

Android :: Access Remote Service In Different Application

Apr 30, 2010

I defined a remote service over a AIDL file. Now i want to access this service in a different application. But how can I do that? The AIDL file is not accessible in my second application, and if i just copy the AIDL file, then the service can't be found.

View 1 Replies View Related

Android :: Broadcast Receiver And Remote Service

Jan 20, 2010

I'm hoping to do some audio processing in a remote service (service I've spawned onto its own thread); this will basically occur in a while (1) loop so constant processing. Occasionally I want to provide some information back to the activity that is bound to the service; I'm doing this by sending a broadcast from the service, that is received by a broadcast receiver on the activity, which then uses the activity's service connection to call into the service and get the information needed; at this point the broadcast receiver makes an alert dialog presenting the information to the user.If I stay in my while(1) loop after raising the broadcast, the action in the broadcast receiver never seems to occur.This is confusing to me since the activity and service are in separate threads.If I end the loop after raising the broadcast, the desired behavior on the activity side occurs, but of course this isn't acceptable since I need to be doing constant processing.

View 11 Replies View Related

Android :: Does Use Of A Remote Service Help Avoiding GC Lags

May 18, 2010

Since yesterday I got an idea running around my mind but I donīt know first if it would work, and then how "hack" it would be.

People who develop audio processing/recording/playback apps for Android know how hard it is to maintain GC away from our critical paths: playing and recording audio. Processing must be as optimized as possible not only to save battery and use less CPU, but also not to create new objects/allocate new memory spaces ... this all to avoid GC at all cost. Well, we have knowledge and this we can handle (mostly). But what about all the other processing that happens from and for user interaction? Media players display images, some apps display ads, ... and sometimes we have to avoid releasing features to the users just to maintain our critical paths free from GC.

Yesterday I stumbled upon an article about remote services and this led me to a doubt: if they can run as a different process, would a GC call from my activity impact the performance of my remote service? I really donīt know how GC works on the Dalvik so this may be a dumb question. If so, I apologize.

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Provide Sample Remote Service Example?

May 6, 2010

Can any one provide sample Remote service example. I want it like two different application. One application should contain service. Another application should use that service.
Thanks in adv....

View 1 Replies View Related







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