Android :: Android Platform - Efficiently Sending Protocol Buffer Messages With Http

Mar 16, 2010

I'm trying to send messages generated by Google Protocol Buffer code via a simple HTTP scheme to a server. What I have currently have implemented is here (forgive the obvious incompletion):
HttpClient client = new DefaultHttpClient();
String url = "http://192.168.1.69:8888/sdroidmarshal";
HttpPost postRequest = new HttpPost(url);
String proto = offers.build().toString();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("sdroidmsg", proto));
postRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs)); try { ResponseHandler<String> responseHandler = new BasicResponseHandler(); String responseBody = client.execute(postRequest, responseHandler);} catch (Throwable t) { }I'm not that experienced with communications over the internet and no more so with HTTP - while I do understand the basics... So my question, before I blindly develop the rest of the application around this, is whether or not this is particularly efficient? I ideally would like to keep messages small and I assume toString() adds some unnecessary formatting.

Android :: Android Platform - Efficiently sending protocol buffer messages with http


Android :: Uploading Bitmap To Server With Http Protocol

Jul 8, 2010

i have a camera Activity after which i take a picture and saving it to gallery and uploading to the server My upload code is not working, i need help on this? // image capture
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
//image Saving
if (requestCode == 0 && resultCode == RESULT_OK)
{ Bundle extras = data.getExtras();
Bitmap b = (Bitmap) extras.get("data");
ImageView mImg;
mImg = (ImageView) findViewById(R.id.head);
mImg.setImageBitmap(b);
// save image to gallery
Shot = "HeadShot"; //Long.toString(System.currentTimeMillis());
MediaStore.Images.Media.insertImage(getContentResolver(), b, Shot, NAME);
//Upload to the server public void Upload(String url, HttpEntity imgdata) throws Exception, Exception {
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "bitmap; charset=utf-8");
post.setURI(new URI(url));
post.setEntity(imgdata);
HttpUriRequest request = post;
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
return entity.getContent();

View 1 Replies View Related

Android :: Buffering While Reading H264 Video (Using HTTP Protocol)

Oct 13, 2010

I'm developing an application on Android 2.2. This application have to read some h264 videos using HTTP protocol. To read a video, I'm using following methods :

// INIT PART mMediaPlayer = new MediaPlayer(); mMediaPlayer.reset();
mMediaPlayer.setOnErrorListener(this); mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnSeekCompleteListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

// SET DATASOURCE mMediaPlayer.reset(); mMediaPlayer.setDataSource(url);
mMediaPlayer.prepareAsync();
In prepareAsync callback : public void onPrepared(MediaPlayer mediaplayer) { mMediaPlayer.start();
}

View 2 Replies View Related

Android :: Sending Multiple Http Requests To Django

May 19, 2010

I am developing a microblogging platform in which I need to populate the page with Post (user defined class with fields) obtained from the Django server using HttpGet.In the client side(Android) I am using GSON to parse the responses from server to the type Post. So I require that server should send Post's one by one so as to add each of them to a list of Posts after parsing and then finally notifying the list adapter of changes in the data set after all Post's have been added.But the problem coming when intially loading the application, the page has to be populated with 10 latest Post's from the server. So I thought of a rather dirty way of sending 10 httpget requests to the server one after the other to the server. The code looks like this.I was thinking of executing it 10 times in a loop to get the 10 Post's I require. But in Django as far I know (correct me if I am wrong) there's no way to keep an index of the last sent Post to the client and so no way to send the 'next' Post on the next HttpGet request. So I am out of ideas.I feel there's a better way to do this efficiently.

View 1 Replies View Related

Android :: Sending Serialized Object To Servlet Using HTTP Client

Jan 5, 2010

I have tried to create a android application that sends a serialzed object from the phone to a servlet the contents of the object is the input from the user which i will store in a database using hibernate.

View 3 Replies View Related

Android :: Sending Data To HTTP Servlet And Receiving String

Dec 30, 2009

This is the servlet code in java ME.

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
ArrayList<String> listName = new ArrayList<String>();
ArrayList<Integer> listLongitude = new ArrayList<Integer>();
ArrayList<Integer> listLatitude = new ArrayList<Integer>();
String sLongitude = (String) request.getParameter("x");
String sLatitude = (String) request.getParameter("y");
String path, list, scount; Integer numLong = null;
Integer numLati = null; Connection con = null; String slanje = "";
int limitLeft, limitRight, limitUp, limitDown, icount = 0;
if (sLongitude != null && sLatitude != null) {
try { numLong = Integer.valueOf(sLongitude);
numLati = Integer.valueOf(sLatitude); } catch(Exception ex) {}
} try{ Class.forName("org.apache.derby.jdbc.ClientDriver");
con = DriverManager.getConnection("jdbc:derby://localhost:1527/bazaprojekt", "projekt2009", "midlet"); limitLeft = numLong - 8; limitRight = numLong + 8; limitUp = numLati + 8; ...

How do I send x and y to servlet and receive some string in Android?

View 2 Replies View Related

Sending And Receiving Asynchronous HTTP Requests?

Jul 20, 2012

I developed a game for Android called Jumping Bird, it writes the score obtained by the player in the database on my web server, but it does so synchronized. While it tries to write data in the database on the web, the entire game is stopped , and worse, when the server is slow, the request takes more than 5 or 10 seconds, an ANR(application not respond) error occurs and the OS tries to close the app.

I wonder how I can make that request asynchronous.There is any library that does it?

View 1 Replies View Related

Motorola Droid :: Sending / Receiving Messages 3 Times - Deleting Messages

Dec 11, 2009

So I was using my the handcent sms app on my Droid today and all a sudden the person i was sending messages to was receiving the messages 3 times. Then all a sudden when i went back to text someone else my whole thread was gone and all my messages had been deleted. Then I try using the stock messaging app and obviously all my threads are deleted but messages send twice, any suggestions?

View 6 Replies View Related

Android :: App For Sending Delayed SMS Messages?

Mar 9, 2010

I saw a thread for an app that allows you to send delayed text messages, deliver in x number of hours, but can't recall the name. I've tried searching but haven't had any luck.

View 4 Replies View Related

Android :: Sending Long Sms Messages

Dec 30, 2009

I've got an app that lets users send sms messages. Works great when the message < 160 characters. After that, things work less-perfectly. Seems like there are a few options here:


Manually break the message up into multiple SMSs, send each part as a separate SMS. Use the multi-part send SMS function (sendMultipartTextMessage()). Send the message as an MMS message (sendDataMessage()?).


Here's my novice take on it:

1)most well supported across carriers. Users may get mad that you just cost them N separate messages though, instead of converting to MMS or something.

2)not sure if this is supported by different carriers, and read that once the message is greater than 3 * 160 chars in length, gets converted to MMS anyway by different SMS apps - maybe stay away from this altogether.

3)not sure how to do this, and older phones might not support MMS. To send an MMS using the android SDK, do we just use the SmsManager.sendDataMessage() method?

View 2 Replies View Related

Android :: Sending Messages With Special Characters

Feb 13, 2009

I do not have a device. I am testing on the emulator. When I send a message(problematically and through the device) with special characters I am not able to view them properly. For Example: When I send a message from one emulator to another say "~Ha". I see only the character "~" in the other emulator.

But when I send the same message from the DDMS, I do not see the problem. Is this a problem with the emulator or am i missing somthing. sm.sendTextMessage("5556", null, "~Ha", null, null);

View 2 Replies View Related

Android :: Sending 1000 Messages In Batch Using SMS API

Jan 14, 2010

I have G1. I write python scripts using ASE. I have to send around 1000 SMSes using SMS API in ASE. I wonder if G1 will be able to hold up-to that? moreover, how much pause (time gap/ sleep) should I give between each message sent. Some of my colleges think that its a crazy idea. I should go for GSM modem. What do you think, is this feasible enough? Can G1 enough capable? I dont have dev version.

View 4 Replies View Related

Android :: Which Class Should Use For Sending Sms/text Messages

Dec 24, 2009

What class can we use to send a text message? I tried this on the emulator, 2.0:

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

And that works ok. On my G1 running 1.5, I get a verify error, guessing because SmsManager is not available in 1.5. Maybe for 1.5 we need to use the deprecated class?:

android.telephony.gsm.SmsManager

Is that correct, or is there some other class we're supposed to use for sending text messages?

View 1 Replies View Related

Android :: SMS Client By Sending Messages From Computer

Apr 5, 2010

Is there any app (preferably free) that allows you to control an ERIS (android1.5)'s SMS client by sending messages from the computer while hooked up to the phone via cable. I'm just lazy and dont feel like picking up my phone half the time...

View 11 Replies View Related

Android :: Sending Messages From My Service To My Activity?

Nov 24, 2010

I have an Android Service which copies files to an ftp server.

While it is doing that, I want to send feedback to my Activity so the user knows what happens.

I tried implementing it using the RemoteMessengerServiceSample code, but I have a problem ... All messages I send during the ftp transfer arrive at my Activity the moment the copy operation is finished ... not message by message while the copy job runs as I would like.

Is there any way to fix this? Maybe i'm using the wrong method for sending messages to my activity?

View 1 Replies View Related

Android :: After Building Platform Source - How To Sign Arbitrary APK With Platform Key

Nov 22, 2010

As an experiment, I would like to use the platform key of my custom built Android platform to sign an arbitrary APK, that is built via the NDK. What is the process to go about doing this?

View 2 Replies View Related

Android :: Sending And Receiving Data Messages Via A BroadcastReceiver

Feb 15, 2009

Is there already functionality similar to the push registry or wireless messaging API in J2ME implemented in Android? Or at least plans to do so?I have been looking at this issue for a while, because in a corporate environment it is essential to be able to push information out, or trigger actions via SMS or other connections.I have successfully sent an SMS between emulator instances, and successfully received an SMS by using a BroadcastReceiver on another emulator instance. I have also been able to use SmsManager. sendDataMessage to send a data message to a port on another emulator instance, but in this case the BroadcastReceiver is never triggered. This seems to be the closest the API's get to what I'm looking for.

View 3 Replies View Related

Android :: Built-in Activity For Sending Text Messages

Mar 11, 2009

Is there a built in activity for sending picture text messages? If so, what does the intent look like that fires it off?

View 2 Replies View Related

Android :: Sending Messages To Subactivity - Currently Running - From The ParentActivity

Jun 1, 2009

Is there any way to send String messages from the parent Activity (running on B/g) to the subActivity (currently running)?

SubActivity is invoked using intent and startActivity(intent);

I want to open EditBox(sub activity) using this method and then update this editBox according to the process going on in the parent activity () and later want to finish() this Box when process in the parent activity completed.

View 5 Replies View Related

Android :: SQL Efficiently Check - An Association Exists

Nov 5, 2010

I have a database of notes and lists, with three association tables.
Basically, lists are parents of notes and other lists, and notes can be parents of other notes in a outline like hierarchy.

I am using this query to return all notes within a list as well as the number of subnotes each note has.

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

This query works just fine, but it's overkill. I don't need to return count(n2.note_id) as Num_Subnotes because I'm only using that value to check if the note has ANY SUBNOTES AT ALL. Essentially it's a boolean value where 0 is false and > 0 is true.

It seems to me that counting all those records is a waste of time when I could just return 1 after finding the first matching value.

Is there a more efficient way to check if count(n2.note_id)>0 in the above query?

View 1 Replies View Related

Android :: Create Views At Run Time And Efficiently?

Mar 18, 2010

I have a case where I have add to listview textview based on no of messages.

1) I am doing like this for.

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

View 5 Replies View Related

Android :: Sending Text Messages On Specific Application Port

Apr 15, 2010

Can anyone explain how to send SMS text messages on a specific application port (including Java and XML code)? If it's impossible then plz show at least how to send & receive SMS data message successfully (Java & XML) on android emulator (and not G1 or others).

View 2 Replies View Related

Android :: Match Efficiently Result String With Various Options?

Jul 6, 2010

When you have a list activity and in onListItemClick() you need to obtain the selected item and then match it against various options, what is the efficient way to do it? switch case cannot be used since I want to match Strings. Is a very long if-else if ladder the only way to do it?

Basically the question is how to do something that normally would be done in switch statement with Strings.

View 3 Replies View Related

Android :: Handset Has Stop Letting Me Pick Recipients Or Sending Txt Messages

Nov 23, 2010

Anyone any answers, handset has stop letting me pick recipients or sending txt messages but it will let me reply to txt.have tried reinstalling but still only works once. Tried rebooting but still nothing. I like this app but its starting to jack me off now and now either need a fix or a suitable replacement

View 6 Replies View Related

Android :: Handcent - Retrying Sending Text Messages In Poor Signal Area

Feb 12, 2010

I get a poor signal at home (did on my Nokia), so half the time when I send a text, there won't be a signal to send it. I always then go and put my phone in a place where there is a signal and leave it..
With my Nokias, the phone would send it fairly quickly (usually within 10-15 minutes).

The message is still sat in Handcent with the whirling round icon next to it. If I copy the message, and resend it, whilst there's a signal, away it goes. I can't find any way to force the send when I want, and I left the resend in a signal area for 1hr 15 mins and it still hadn't sent..

View 4 Replies View Related

Android :: Sending Messages Of Different Types To Android Handler

Jul 5, 2010

Is there a way to distinguish between types of messages sent to an Android Handler? For example, I have 2 background threads and would like the handler to recognize which thread a message came from.

View 2 Replies View Related

Android :: Android - What's Best Way To Test Sending / Receiving MMS Messages?

Oct 11, 2010

I'm writing an app that stores secret (encrypted+hidden using steg) information in MMS messages. Obviously I need a way to test this, in particular, sending and receiving MMS messages. I have one Android phone, a Nexus One. I know that MMS's cannot be sent between emulator instances, but other than using up loads of MMS credit, is there another way of testing out MMS sending/receiving without just spending loads of money?

View 1 Replies View Related

HTC Incredible :: Sending MMS Messages

May 21, 2010

I did a search on this and didn't come up with any hits for the inc.If I want to send a long message (over 160 characters) I use to be able to send as mms on my bb and it would not break the message up into seperate messages like it did on regular sms.How do I do this on the Inc? I looked for a mms option when texting and didn't find one. I am using Handcent and shapewriter for a keyboard, but also looked on the stock messaging app and didn't see one there either.

View 2 Replies View Related

HTC EVO 4G :: Sending Video Messages

Jul 24, 2010

I lowered my resolution to VGA and i was actually able to send the video message but it took forever (and it was only a 6 second video) and then i got a text back saying that my friends phone couldnt support the file or somethin.He just got a Droid X so I dont see why it would say that and he has unlimited data.Anybody else having problems sending video messages?

View 4 Replies View Related

HTC EVO 4G :: Sending MMS Messages Via Handcent?

Jun 10, 2010

Anyone having problems sending MMS messages via handcent? This worked fine on my HERO, but doesn't work on my Evo. I can send MMS messages via the stock messaging app, but handcent just spins and never sends the message. Normal SMS messages work fine.

View 18 Replies View Related







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