Android Datagram Sockets Not Working?
Sep 24, 2013
I am trying to implement basic Datagram Sockets in Android. I am starting with one of the samples available on the web:
Code:
String messageStr="Hello Android!";
int server_port = 54372;
try {
[code].....
The program dies when it hits the s.send(p) command.
View 2 Replies
Jun 6, 2009
An application I'm working on stopped being usable after upgrading to 1.5, and the reason seems to be that, after joining a WiFi network and creating a TCP/IP or UDP/IP socket, there is no way to communicate using it from a remote entity. I can not even ping the phone using the normal ping command, which was possible using 1.0. This affects my program since it's using mDNS/DNS-SD and peer-to-peer TCP sockets for communication. Is there anyone else who can confirm this?I have tried running the program built with SDK 1.0 and SDK 1.5 while running on a real phone running Android 1.5 and the problem is still the same.
View 2 Replies
View Related
Sep 20, 2012
I'm trying to develop multiplayer game , like any usual games join to room game then the score of game sharing with another player. After I'm searching in Google , what i see i should be start on DatagramSocket , in this link URL..., i can create my WiFi internet game throwing DatagramSocket or i need something else.
View 1 Replies
View Related
May 12, 2012
I have developed a simple UDP connection protocol in C++ that I am currently using fine on windows machines. I want to proceed to develop a java client class for use in android applications.
Everything seems to be simple enough (except for eclipse constantly bugging out) but I appear to have hit a brick wall. Here is the code that I run when a button is pressed (all I want at this stage is to get a packet through):
Code:
DatagramPacket sendPacket = new DatagramPacket("HELLO!".getBytes(), 6, servAddr, server_port);
Log.d("UdpTest", "blah");
try {
Log.d("UdpTest", "blah2");
servSock.send(sendPacket);
[Code] ....
I am trying to catch the exception, so I am not sure how it is uncaught. This is practically my first attempt at Java so I could be mistaken in that the uncaught exception is not my problem and is just mentioned because of however Android is deciding to fail on the send() method.
The only permission my app should require is android.permission.INTERNET is it not? Oddly, if I remove the permission the app crashes in exactly the same way which would suggest to me that it needs some other permission, the permissions are not applying correctly or that the problem has nothing to do with permissions (it is failing before it gets far enough to care).
So far, I think it could be a strange ICS problem, but that wouldn't make sense because I haven't seen any other app that is likely to use UDP simply stop responding on my phone (edit: I have actually, see my next post). The other alternative is that my Java is just horribly wrong (i hope so).
Here is my code:
Code:
public class UdpTestActivity extends Activity {
String text;
int server_port = 25505;
byte[] message = new byte[3000];
DatagramSocket servSock;
[Code] ....
View 3 Replies
View Related
May 1, 2010
For my app, I need to record audio from MIC on an Android phone, and send it over TCP to the other android phone, where it needs to be played. I am using AudioRecord and AudioTrack class. This works great with a file - write audio to the file using DataOutputStream, and read from it using DataInputStream. However, if I obtain the same stream from a socket instead of a File, and try writing to it, I get an exception. I am at a loss to understand what could possibly be going wrong.
This is the code:.................
View 2 Replies
View Related
Jul 9, 2010
I've been trying to connect two Android devices (2.1) via TCP sockets.
The vital part of the code:
Server:
ServerSocket serverSocket = new ServerSocket(SERVERPORT);
Client:
Socket socket = new Socket(serverAddr, SERVERPORT);
The weird thing is I can make it work if the client is an emulator, but the same code fails if running both of them on real devices.
The failure in the client side is:
CODE:................
I tried with WIFI and mobile net too, they were in the same subnet both times, INTERNET permission is given, the server is addressed through its real 192.168.. IP. I am planning to change the socket implementation with setCustomSocketImplFactory(). The problem is crucial in the process of implementing MSRP protocol to Android.
View 1 Replies
View Related
Sep 20, 2010
In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchronous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets?
View 1 Replies
View Related
May 30, 2010
I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature.
Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job
View 1 Replies
View Related
Nov 19, 2009
I would like to simulate a small cluster of Android devices either on one laptop (worst-case), or on several machines on a private network. This is for testing communications and process migration on Android.
Is there a safe way to identify and launch a particular emulator from a given application under Eclipse? I have a recent Eclipse/Java/ADT setup and I'm using the a variety of tutorials from Mark Murphy, Meier, and Abelson.
View 1 Replies
View Related
May 22, 2012
Is it possible to write a in-app openvpn connection (via streams and sockets)? If it is, then is there any android application which managed that already? I have also problems finding in-depth openvpn protocol description.
View 4 Replies
View Related
Jul 16, 2010
I have a self signed server certificate (cert.pem) and need to enable it for SSL sockets in an Android application. Ideally I'd like to package the code as .jar file and not need an external certificate file (i.e. include it into the code). With this code I can accept all certificates, which is not what I want: SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, new TrustManager [] { new MyTrustManager() }, new SecureRandom());
Do I need to add the certificate to a custom KeyManager or the custom TrustManager? One problem I've encountered is that Android does not accept JKS keystores (KeyStore.getDefaultType() returns "BKS"): "java.security.KeyStoreException: KeyStore JKS implementation not found"
View 1 Replies
View Related
Nov 9, 2013
I cant sync my google accounts ('sync is currently experiencing problems, it will be back shorly)
Google maps says 'no network connection'
Play store says 'server error'
Gmail says 'waiting for sync, your emails will appear shorly'
Sounds like my internet is broken? ITS NOT. whatsapp and opera mini, web browser is still working 100% and able to connect
I have tried:
turning sync of and on
clear the cache of various google apps
turning the phone off and on
The last action I did before it worked was to uninstall the 'microsoft outlook app'.
View 2 Replies
View Related
Sep 3, 2010
Had WiFi working earlier now it has stopped but laptop still working ok?
View 1 Replies
View Related
Jul 25, 2010
I have an Android SQLite/ContentProvider problem that I have been beating my head against the wall for over the past 3 hours.
View 1 Replies
View Related
Jan 7, 2010
I know there have been other threads about the Youtube app no longer working (majority of the time), but it looks like it hasn't been commented on in awhile.SO, I really want to get this phone but won't until I know the bug is fixed.Can you Eris users let me know if your Youtube app is working or not working? (basically by not working I mean, almost every video you try to open you get a message saying: "Sorry, this video cannot be played")Also, does anyone have any logical ideas as to why not EVERY Eris user is affected by this bug?
View 22 Replies
View Related
Feb 24, 2010
After finally getting ADC0.3BetaDark up and running, I can no longer access SetCPU.I uninstalled it, then reinstalled, let it search my phone automatically, and it freezes at the SU request.Also, when puttin SU into Terminal Emulator, I get stuck.
View 2 Replies
View Related
Sep 23, 2009
I just started another project that includes maps and just like in the previous project, I can't get the maps to work (the code is identical with the map view tutorial). In my last project, I never managed to make the maps display on one machine, and it worked right away on the other one. I have followed the same procedure in both cases and I have also followed in now.
View 3 Replies
View Related
Jan 27, 2010
I am following all the steps in my Activity to check whether the TTS is available before call speak().I see the following in my LogCat which seems fine.But it's simply silent, no voice spoken.I also tried it on my Nexus One, with the TTS enabled in settings.
View 2 Replies
View Related
Oct 22, 2009
I've tried the geo fix command to set coordinates for a program I wrote that provides the GPS coordinates. This program worked fine in 1.1.But the geo fix command got broken in 1.5 and appears to still have not been fixed in 1.6? When will it be fixed?
View 13 Replies
View Related
Jun 14, 2010
i have two programmes ,a TextSpeaker in which i start a TTS engine and a SmsReceiver pgm where i use BroadcastReceiver to inform user of any incoming message . Both these pgms worked well when run separately ,but when i kept them in the same project so as to make the incoming msg in voice form i am getting runtime error .
View 3 Replies
View Related
Jul 30, 2010
I followed the offical guidelines, I copyed the LVL source into my project and added the correct manifest attribute.I also copyed from LVL sample folder the mainactivity.java into my project, changed the public key with the one from my developer console.When I launch my software the MainActivity tell me always the application is not licensed also if I specified that is Licensed from my developer console.In addition when I click on the buy now button after it told me that application is not licensed, it will redirect me on the android market and I got a 404 error. Probably because emulator isn't authorized to access the market, I don't know.
View 6 Replies
View Related
Jul 13, 2009
For the past month or so my "hello aim" application won't connect anymore.It's killing me since it's by far the best aim app out there.Also, it will ocationaly tell me there's an update in the market, but when I click on the update, it goes to the market and tell's me that nothing matches my criteria. Can anyone help me out with this one?My phone hasn't been the same since.
View 7 Replies
View Related
Aug 5, 2010
QIK app not working after downloading Froyo. It keeps telling me cannot connect to server. even if WiFi is off i get the same error.
View 3 Replies
View Related
Sep 30, 2010
I followed the instructions on setting up the Android SDK by installing the java SDK first, then the Android SDK (including the various platforms), installed eclipse, set up the ADT for eclipse plugin, and typed in the code (I copy and pasted straight from the site too but still didn't work)
What I get when I run the app is the screen just saying ANDROID_
The emulator starts up fine and everything, but none of the code runs. I tried the xml and the hard code example but both resulted in the same thing.
View 2 Replies
View Related
Jun 15, 2010
I have written a simple app which would speak out to the user any incoming message. Both programmes seem to work perfectly when i lauched them as two separate pgms , but on keeping them in the same project/package only the speaker programme screen is seen and the receiver pgm doesn't seem to work .
The speaker pgm is:
CODE:..........
And the Receiver programme is:
COD:.....................
View 2 Replies
View Related
Apr 24, 2009
Alright so i was using oi notepad to take some important notes I needed. Then I pressed menu and pressed 'Revert' and it converted my text into a whole bunch of random letters and numbers... Can anyone help me out? I really need to get these notes back theyre important
View 2 Replies
View Related
May 15, 2009
I have two problem regarding Location API for SDK 1.5
1) I have developed a location based application for SDK 1.0.
I have used Geocoder to get the location data. Its working fine on SDK 1.0 emulator and its supported devices.
Today I downloaded SDK 1.5, and tried to run the same app. But the Geocoder didn't give any result. I am getting
Geocoder.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1) as null.
2) LocationManager.removeUpdates(location_listener) is not removed (I mean still the GPS icon is visible on emulator).
But the same worked fine on SDK 1.0.
View 2 Replies
View Related
Oct 8, 2010
Anybody having issues with their Pandora app? Mine gets stuck on loading and i have un installed it and installed it and still the same.
View 5 Replies
View Related
Sep 29, 2010
I am using the Tab Layout almost copied from the example provided. But it's not working: public class TabHolder extends TabActivity {/** Called when the activity is first created. */ @Override
View 6 Replies
View Related
Nov 13, 2010
I'm on Mac OS X Leopard and installed the ADT plugin into Eclipse Galileo. I followed all these steps to get started:
http://developer.android.com/sdk/index.html
My SDK version is 2.2 API 8 revision 2 and I just used the Hello World tutorial found here:
[url]
When I first created the Android application, I saw this error in the Eclipse console:
[2010-11-13 18:20:43 - HelloAndroid] ERROR: Unable to open class file / Users/mydirectory/Documents/workspace/HelloAndroid/gen/com/example/ helloandroid/R.java: No such file or directory
I commented out this line to fill in the few lines from the tutorial:
setContentView(R.layout.main);
When I ran the app, it launched my emulator but all I saw was a vertical screen on the left that said "ANDROID" and phone buttons on the right. I did not see the "Hello, Android" text from the tutorial.
View 2 Replies
View Related