Trying to get files from ftp server - Java for Android App Development

Hello all
i'm trying to make a button that connects to an ftp server and download a bunch of files
i have everything figured out , but i'm wondering how to execute it , should i use asynctask ?
i want to also update progress and such ...
the files will be around 60MB so i don't know how long it will take , a few minutes i guess depends on the connection .
is there a more suitable answer than asynctask ?
thanks to all helpers !

I think asynctask would be a nice solution, progress updating is included as well (publishProgress(int progress) and then by overriding onProgressUpdate(...) you can access ui elements)
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

Related

Proximity Sensor Problem

Hi all,
Like many of us, I managed to kill a digitizer on my HTC Aria. Replaced the blasted thing, and now I find my proximity sensor is really sensitive. It's locked in proximity mode (Z-devicetest shows distance 0) in normal conditions.
If I pull off the digitizer, so the prox sensor has a clear path in front of it, it goes out of proximity state and Z-devicetest shows the distance as 1 (and the display works properly during calls, speakerphone works, etc) ...
If I slowly move the tip of my finger towards the prox. sensor, digitizer still removed, Z-devicetest shows it flip from 1 to 0 (out of prox to in prox) as my finger gets within ~2 inches.
So it seems the prox. sensor is working but is too sensitive.
Is this the normal failure mode of a CM3602 prox sensor (read: i dropped it, and not only broke the digizer, but took out the prox sensor too!) .. or, is there some sort of calibration i need to do?
Anyone have a USA source of the CM3602? My usual suppliers digikey and mouser don't carry this component..
*curses self* shoulda listened to my friend who warned me this phone is real easy to bust
There is a guy in the accessories board that is selling parts of his aria. I'd link ya but I don't know how from this app.
Sent from my Liberty using XDA App
Right on.
I didn't want to butcher this poor little POS more so I figured out how to turn the bloody sensor off in software.
append
gsm.proximity.enable=false
to /system/build.prop
or just uncomment the line if you have an editor.. but you can just cat >> build.prop in the shell and type in the line. No editor needed.
Must do this via adb shell with phone in clockwork, otherwise nand is lokt. boo. dev eng hardware doesn't have that problem... stupid consumer devices!
So do you just start Android sdk and then type the following.
append (enter)
gsm.proximity.enable=false (enter)
or is there more to it. I really need to get this disabled.
I tried to do it with ASTRO but it doesnt save my changes.
/system/build.prop is a standard text file.
Remember that stuff in /system is protected, I find the best way to deal with the /system partition is through clockworkmod recovery.
a. Disconnect USB, reboot into clockworkmod recovery
b. Mount the /system partition from the partitions menu
c. Connect USB to a system with adb
d. adb pull /system/build.prop
e. Edit file with your favorite text editor to append gsm.proximity.enable=false
f. adb push build.prop /system/build.prop
g. unmount /system from clockworkmod recovery partition menu
h. reboot phone, receive bacon
If you don't have clockworkmod recovery, just use unrevoked to install it
Oh, i should also say CM6 (and maybe all of Froyo images?) do not honor this setting.
Thank you I will try this when I get home..
I may have an issue because if I open build.prop with root explorer it says...
# try to disable proximity sensor in call by default
# gsm.proximity.enable=false
This is located almost at the bottom of the page does this mean I am sol. It is the liberated Rom and I haven't done anything to it.
Sent from my HTC Liberty using XDA App
Just remove the # ...
# gsm.proximity.enable=false
..to
gsm.proximity.enable=false
thank you so much..... you may be oh wait you are the FN man.
ok so if froyo images dont honor this does that mean when we get froyo I shouldn't upgrade.
anyway thank you so much now I can use my phone again, I didn't realize how much my Pure was dated till I had to use it for a few days.
Glad that helped
I didn't find a property in Froyo that disabled the proximity sensor. Maybe there is one, maybe there is not. I went another method..
Code:
# hexdump -C /system/lib/hw/sensors.liberty.so | grep -C3 dev/cm
00001b10 54 5f 54 46 4c 41 47 20 65 72 72 6f 72 20 28 25 |T_TFLAG error (%|
00001b20 73 29 00 45 43 53 5f 49 4f 43 54 4c 5f 41 50 50 |s).ECS_IOCTL_APP|
00001b30 5f 53 45 54 5f 4d 56 46 4c 41 47 20 65 72 72 6f |_SET_MVFLAG erro|
00001b40 72 20 28 25 73 29 00 2f 64 65 76 2f 63 6d 66 75 |r (%s)./dev/cmfu|
00001b50 6b 74 00 43 41 50 45 4c 4c 41 5f 43 4d 33 36 30 |kt.CAPELLA_CM360|
00001b60 32 5f 49 4f 43 54 4c 5f 45 4e 41 42 4c 45 20 65 |2_IOCTL_ENABLE e|
00001b70 72 72 6f 72 20 28 25 73 29 00 2f 64 65 76 2f 6c |rror (%s)./dev/l|
Offset 1b48 in /system/lib/hw/sensors.liberty.so defines the device name of the proximity sensor, normally /dev/cm3602.
Hexedit the file to change the name of the device to something that doesn't exist, and you will no longer use the proximity sensor.
Nasty and totally the wrong way to do this, but it worked for me. I suppose I could have dug through source code to check for a flag to disable the sensor, but that takes more time and is far less hacking fun than hex editing a system library If I didn't want to live dangerously I'd stick with the stock ROM lol.
Thanks again I will check back when group comes out if I can't figure it out. I am going to stick with the liberated Rom till we get the official Rom and it gets liberated.
Sent from my HTC Liberty using XDA App
Not a bad idea if you're happy with 2.1 and Sense
Yeah I really like the sense UI so I will stay with 2.1 until a 2.2 with sense is available.
Sent from my HTC Liberty using XDA App
Thanks for this info. Just changed CM3602 to XM3602 and it stopped.
I just upgraded to the new attn1 2.2 Rom with sense and I used the same fix you gave me for the 2.1 Rom and it worked so I guess that fix will work on all sence roms.
Sent from my HTC Liberty using XDA App
I just used hexeditor on my phone ( fr 2.2) and went to the location you noted 00001b48 but nothing there. I went on looking and found it on a few lines starting at 00002090. but which value do I change to get it to disable. If you could look at this for me it would help alot.
nrvate said:
/system/build.prop is a standard text file.
Remember that stuff in /system is protected, I find the best way to deal with the /system partition is through clockworkmod recovery.
a. Disconnect USB, reboot into clockworkmod recovery
b. Mount the /system partition from the partitions menu
c. Connect USB to a system with adb
d. adb pull /system/build.prop
e. Edit file with your favorite text editor to append gsm.proximity.enable=false
f. adb push build.prop /system/build.prop
g. unmount /system from clockworkmod recovery partition menu
h. reboot phone, receive bacon
If you don't have clockworkmod recovery, just use unrevoked to install it
Click to expand...
Click to collapse
I am trying to use these steps to disable the sensor, but I am having issues pulling build.prop.
In the command prompt, I enter in:
adb pull /system/build.prop c:\
And receive:
264 Kb/s (4695 bytes in .012s)
The issue I am having is that I cannot find where adb stores the file on my computer. It's not in the c:\ directory. It's not in platform-tools folder. I did a search, and nothing came up
Any suggests would be really appreciated.
Thanks!
I'm confused - why are you guys disabling the proximity sensor???
Is it because you improperly installed a new screen?
Might as well use duct tape to hold the new screen on and then JB Weld the back case. Seriously guys, do things right and take the screen back off and install it the right way.
kaschenberg,
I dropped my phone, shattering the screen; resulting in a lot of fractures in the glass where the sensor is located. The phone and screen works when I add pressure to the upper right corner, leaving me to believe the sensor is being interrupted by the fractures. I am hopeful, as a temporary fix, that if I can disable the sensor, the phone will work more optimally until I replace the screen.
- Thoughts?

Cannot resolve symbol "charSequence"

Hi first time here and first time trying to write android code. Ive done java in eclipse earlier. anyway i follow some guide on utube and he writes charSequence. however I dont seem to have that cause it get red, do i need to import some library?
Well if you don't capitalize the first letter it will be a variable name instead of a data type...
CharSequence charSequence = ....
This should work better
But hey, this is a really really basic thing about java and coding in general, always check if you did the capitalization right!
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
As said Masrepus, CharSequence is a class. And all class begin with a capitalize letter.
all other words are variable (if not keyword like if, switch, case, try, etc...) or function name

[Q] Secondary icon in notification

Hi
Firstly I apologise if I have put this into the wrong section within the forum.
I'm wanting to remove the secondary icon from a notification within a particular app. Also on some apps like WhatsApp it will also show a notification count (next to the secondary icon) Please see below link which gives an example.
//developer.android.com/design/patterns/notifications_k.html
Which line of code do I need to find and remove so the secondary icon and notification count no longer appears?
Thanks.
There will be called NotificationBuilder at some instance and there look for a method call to setSmallIcon(...)
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
When searching through the code I found a few lines looking like this;
invoke-virtual {v1, v2, v3}, Landroid/app/Notification$Builder;->setSmallIcon(II)Landroid/app/Notification$Builder;
When I removed each line then the application crashed prior to the notification being displayed in the status bar. Meaning no notification was shown, however I was still able to open the app.
What would I need to change in this line to prevent the secondary icon from displaying?
Thanks.

[Q] Proper way to use SQLite?

So I created an app long ago, and back then to read from a SQLite DB was to use a managed cursor with startManagingCursor().
Now, that is not only depreciated, but also not available in fragments. They say use a Loader, which requires CursorLoader, which apparently generally requires a ContentProvider. But if you look in the Content Provider documentation, it says "You don't need a provider to use an SQLite database if the use is entirely within your own application."
So, I can't use a managed cursor, but then I also shouldn't use a ContentProvider. I don't need to share this data with any other apps. This is a small app, with small databases, only for my app. Do I need to write my own Loader? It seems crazy that managing data in a database has become complex for some pretty basic data storing/managing.
Am I missing something? Is there a better way to get data from an SQLite database on Android? What does everyone else do?
http://www.vogella.com/tutorials/AndroidSQLite/article.html
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

TA Backup for G814x only

If someone interested, just try this small tool:
Run from cmdline (according to sample image), connect device in flash mode, and wait a bit.
*binary* comes from device directly, *config* is in infile format if you want to know what is inside.
No virus / other foreign legionary inside :
https://www.virustotal.com/#/file/8...f13e2099bc9b5a1ddb487ad41cb3948144d/detection
Works on G814x, may work on other devices, but not before (and including) Z5 Premium.
How to fix DRM on XZP:
Step one: Collect Underpants.
Step two: Backup TA.
Step three: Profit.
But seriously, good luck to all testing this. Please report back!
No matter how unstable or chancy this may be (haven't tested, don't wanna risk it haha) it''s progress in this right direction and to the idiots that gave up in the bounty thread, having patience can pay off
Its working. If you don't want to try, don't do that. This is not violence, this only an option To make a drm fix, this could be a step forward.
It's NOT write anything to the device, so safe to try. I have only one G8142, tested, read working fine. On weekend, I'll work on full/partial restore.
Anyway, its not for personal profit, I just want to speed up a complete lossless root solution
Just tested, files have been created, and phone is working without any problem.
Hope someone could get DRM fix soon or at least a point to start with this tool.
Thanks a lot for the effort
Mine just hangs on Checking S1 devices
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Edit: Sorry Didn't read the part that need to connect FLASH MODE It backed up stuff.
does it work with sony xz1 or should wait for next update
karrouma said:
does it work with sony xz1 or should wait for next update
Click to expand...
Click to collapse
You can test is. It cannot write anything, at most cannot read anything.
BTW, this is NOT A RAW TA BACKUP, it backup what the phone give us. But I hope it contains any DRM related stuff
I hope someone will try it out who can understand what it read out, and can give us some feedback.
Anyway, unlocked my one, I love new green shots, but now I can attack from another way too. Looks like dd raw backup
a bit bigger, even its not fully filled
Very good work. It's because people like you that things get done.
HELLO !!! @Macs1209 PERFECT WORK BRO !!!
MY PHONE IS G8141 with windows 7 x64
E:\SONY\XPERIA XZ PREMIUM>dmsSonyTABackup.exe
Checking S1 devices
S1 interface found: \\?\USB#VID_0FCE&PID_B00B#5&1dd2df13&0&2#{a5dcbf10-6530-11d2
-901f-00c04fb951ed}
TA1 binary read ok, size: 139096, saved to E:\SONY\XPERIA XZ PREMIUM\MY IMEI_TA_1.binary.tab
- TA binary parsed, saved to E:\SONY\XPERIA XZ PREMIUM\MY IMEI_TA_1.confi
g.tab
TA2 binary read ok, size: 179230, saved to E:\SONY\XPERIA XZ PREMIUM\MY IMEI_TA_2.binary.tab
- TA binary parsed, saved to E:\SONY\XPERIA XZ PREMIUM\MY IMEI_TA_2.confi
g.tab
THANK YOU VERY VERY SO MUCH GOOD WORK
ps it 's possible change in TA.img or add restore ?
please help bro @munjeni
LukeyWolf said:
No matter how unstable or chancy this may be (haven't tested, don't wanna risk it haha) it''s progress in this right direction and to the idiots that gave up in the bounty thread, having patience can pay off
Click to expand...
Click to collapse
There's a quote in Urdu "sabar ka phal meetha hota he" means that the fruit of patience is always sweet.
kudos to this guy. since S8 Snapdragon 835 version is now rooted. i hope we can get Root and Drm keys together sooner on our XZP
Saadkhalid786 said:
There's a quote in Urdu "sabar ka phal meetha hota he" means that the fruit of patience is always sweet.
kudos to this guy. since S8 Snapdragon 835 version is now rooted. i hope we can get Root and Drm keys together sooner on our XZP
Click to expand...
Click to collapse
Yep, a grest step in the correct direction, also I have to wait anyway haha as I only got my XZP 1 month ago with EE locked haha
I can help reconstruct real TA.img!
Edit:
This tool doesn't backup drm key, I didn't see unit 66667. Without shake authentification I'm believing you can't backup secured units including that drm key unit. I'm still believing that drm key or unlock key is outside trim area, I even didn't see unit 0x8b2 from unlocked device trim area. https://github.com/munjeni/newflasher , can you show your's?
@the_laser , how that is possible that his tool reads some units like:
Code:
[67320]
size=2
data=9A 02
text=
[67321]
size=2
data=FA 01
text=
[67322]
size=2
data=3A 01
text=:
[67323]
size=2
data=1A 01
text=
This works on XZ1 Compact.
It produced 4 files:
[IMEI]_TA_1.binary.tab (146036 bytes)
[IMEI]_TA_1.config.tab (Text display of above)
[IMEI]_TA_2.binary.tab (183728 bytes)
[IMEI]_TA_2.config.tab (Text display of above)
EDIT: For reference, the XZ1c's TA partition is 2MB, so this tool is pulling < 1/4th of that partition.
I don't see 66667 or 8B2 either.
Thanks for responses. So now I need to focus on 66667 abnd 0x8B2.
BTW, "text=" lines for info only, to see is there any text inside, like imei, any sw part version, or log data.
Another question: is there any way to create a modem interface for this device? In the modem firmware part, there's
lot of AT commands, but without interface, I can't communicate with the baseband. On Samsung qualcomm devices,
I could reach lot of things via modem, same logs what are in the partial TA backup binaries. (also I killed one exynos
g925f by wrote something wrong to RF calibration.... )
pbarrette said:
This works on XZ1 Compact.
It produced 4 files:
[IMEI]_TA_1.binary.tab (146036 bytes)
[IMEI]_TA_1.config.tab (Text display of above)
[IMEI]_TA_2.binary.tab (183728 bytes)
[IMEI]_TA_2.config.tab (Text display of above)
EDIT: For reference, the XZ1c's TA partition is 2MB, so this tool is pulling < 1/4th of that partition.
I don't see 66667 or 8B2 either.
Click to expand...
Click to collapse
The tool didn't find my XZ1c, tough I probably need some special drivers that I missed.
Those files are s1 dump for Sony repair services
That provide device info, last Boot logs, installed firmware versions, baseband info, etc
Small parts of TA nothing important
pbarrette said:
This works on XZ1 Compact.
It produced 4 files:
[IMEI]_TA_1.binary.tab (146036 bytes)
[IMEI]_TA_1.config.tab (Text display of above)
[IMEI]_TA_2.binary.tab (183728 bytes)
[IMEI]_TA_2.config.tab (Text display of above)
EDIT: For reference, the XZ1c's TA partition is 2MB, so this tool is pulling < 1/4th of that partition.
I don't see 66667 or 8B2 either.
Click to expand...
Click to collapse
@Macs1209
it is wirking in xz1 also
i got same 4 files
xzp xzc xz1 same drm and same oreo firmware family like xz and xzs
pbarrette said:
EDIT: For reference, the XZ1c's TA partition is 2MB, so this tool is pulling < 1/4th of that partition.
Click to expand...
Click to collapse
Yes partition is 2mb but that not mean that it have 2mb of the data inside! So thats expected.
---------- Post added at 09:39 AM ---------- Previous post was at 09:38 AM ----------
munjeni said:
https://github.com/munjeni/newflasher , can you show your's?
Click to expand...
Click to collapse
Macs1209 said:
Another question: is there any way to create a modem interface for this device?
Click to expand...
Click to collapse
Yes, but waiting your reaply to my question first.
munjeni said:
Yes partition is 2mb but that not mean that it have 2mb of the data inside! So thats expected.
---------- Post added at 09:39 AM ---------- Previous post was at 09:38 AM ----------
Yes, but waiting your reaply to my question first.
Click to expand...
Click to collapse
Code:
Checking S1 devices
S1 interface found: \\?\USB#VID_0FCE&PID_B00B#6&f44bfc6&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Response(BIN): SUCCESS: 104857600
Response(HEX): SUCCESS: 31 30 34 38 35 37 36 30 30
Reading TA 1 / 2226
Response(BIN): FAILED: Unable to read TA unit 2226, error=-22
Response(HEX): FAILED: 55 6E 61 62 6C 65 20 74 6F 20 72 65 61 64 20 54 41 20 75 6E 69 74 20 32 32 32 36 2C 20 65 72 72 6F 72 3D 2D 32 32
Reading TA 2 / 2226
Response(BIN): FAILED: Unable to read TA unit 2226, error=-22
Response(HEX): FAILED: 55 6E 61 62 6C 65 20 74 6F 20 72 65 61 64 20 54 41 20 75 6E 69 74 20 32 32 32 36 2C 20 65 72 72 6F 72 3D 2D 32 32
Reading TA 1 / 66667
Response(BIN): FAILED: Unable to read TA unit 66667, error=-22
Response(HEX): FAILED: 55 6E 61 62 6C 65 20 74 6F 20 72 65 61 64 20 54 41 20 75 6E 69 74 20 36 36 36 36 37 2C 20 65 72 72 6F 72 3D 2D 32 32
Reading TA 2 / 66667
Response(BIN): FAILED: Command not authenticated
Response(HEX): FAILED: 43 6F 6D 6D 61 6E 64 20 6E 6F 74 20 61 75 74 68 65 6E 74 69 63 61 74 65 64
Done
Sadly not. 2/66667 looks like needs some authentication, but after it possible to read
(I already unlocked this device, so error-22 can mean TA ID not exists (anymore) too)

Categories

Resources