Convert small java program to android

I'm trying to make the java SNTP client ( [url removed, login to view] ) work on Android 4.2. The SNTP client is less than 500 lines of code include brackets and the actual amount of code modified to work on Android is minimal. I've converted some of it, but I'm now lost why my code is crashing. If you have familiarity with sockets and datagramPackets, this should be easy for you.

[url removed, login to view] is my workspace project that contains the JavaSntpClient Code, which was imported from the link above

[url removed, login to view] is my Android code. My code crashes at line 48 of [url removed, login to view] at [url removed, login to view]

Basically, your job is to either use my project "TEST" or write your own hello world code from scratch so that I can run an NTP-SNTP setup. Use the same outputs that appear in the print statements in the [url removed, login to view] for the [url removed, login to view] I'm okay printing the information Log, you don't have to make any views and can keep the hello-world view that is default.

What I've done:

Imported [url removed, login to view] and on line 421 added [url removed, login to view]

Copied over code from [url removed, login to view] to [url removed, login to view], added try-catch statements and converted [url removed, login to view] to Log.v

How to run an NTP server:

If you run a linux or mac OS system, your computer should have an NTP server on it without needing to do anything. Just make your computer broadcast a wi-fi network and connect to this. The static IP address should be the server you connect to for the NTP server. I recommend running SntpClient first on another computer to make sure you are able to connect and get the NTP time, which looks like:

NTP request sent, waiting for response...

NTP server: [url removed, login to view]

Leap indicator: 0

Version: 3

Mode: 4

Stratum: 3

Poll: 0

Precision: -20 (9.5E-7 seconds)

Root delay: 35.61 ms

Root dispersion: 346.27 ms

Reference identifier: [url removed, login to view]

Reference timestamp: 13-Dec-2012 21:34:24.186704

Originate timestamp: 13-Dec-2012 21:43:30.051000

Receive timestamp: 13-Dec-2012 21:43:21.949061

Transmit timestamp: 13-Dec-2012 21:43:21.949175

Dest. timestamp: 13-Dec-2012 21:43:30.054000

Round-trip delay: 2.89 ms

Local clock offset: [url removed, login to view] ms

NOTE: If you don't want to setup your own NTP server, use a public NTP server. For example or anything else on this list

I solved the issue. The upgrade to honeycomb prevents network functions from running on the Main (UI) thread.

I'm closing this project.

Evner: Android, Mobile App Development

Se mere: java hello world converted android, sntp, java program work android, convert android code java work, why root android, what version of android do i have, what job can i get with a linux, what is computer program, what is android os, what is android 4.3, what android version do i have, what android phone should i get, root your android, root my android, root for android, root android without computer, root android phone without computer, root android phone, root android no computer, print println java, printing from android, print from android phone, print from android, phone support 24 7, originate

Om arbejdsgiveren:
( 1 bedømmelse ) Houston, United States

Projekt ID: #4039839

1 freelancer byder i gennemsnit $100 på dette job


lets do it

$100 USD på 1 dag
(3 bedømmelser)