[Q] [HELP] Regarding client server app - General Questions and Answers

I am trying to develop a client - server application. I have a few questions regarding the complete dev process. I am using Nexus 7 GPe with android 4.4.2 (not rooted)
Please help me with the following question.
1) How can I take logs without connecting my device to the ADB as android 4.4.2 has a restriction and the logcat applications cannot read the logs because of that?
2) If I connect the device to ADB and try to run my code, I get a permission denied error while reading a file that is stored at "/mnt/shell/emulated/0/Movies", how can I resolve that
3) To use the code on an emulator, I used to re-direct ports. Will I have to do the same while debugging the code on the device? Also, if yes, how can I redir or open ports for TCP/UDP connections through my application on the device.
Thanks in advance

Related

[Q] I Have A Question About Status Bars...

I see when some people take down their status bar, it has a little android with it. Like when you pull it down, a picture of an android follows it. How can i make/put that in?
Debugging mode Enabled...
http://www.makeuseof.com/tag/what-is-usb-debugging-mode-on-android-makeuseof-explains/
jiseuo said:
Debugging mode Enabled...
http://www.makeuseof.com/tag/what-is-usb-debugging-mode-on-android-makeuseof-explains/
Click to expand...
Click to collapse
And then? Please explain.
C00lBeanz said:
And then? Please explain.
Click to expand...
Click to collapse
Please read linked article, but short version is:
USB Debugging mode - special communication mode with other device. Used mainly by developers to debug new apps. It can be also used for hacking or modifying ROM files. Nothing for common users
Enabling USB debugging essentially starts up the adb daemon on your device, which allows it to communicate with adb on another device to enable debugging commands.
It's used when developing and debugging applications, and allows you (primarily) to:
- Transfer data between a computer and your device (both ways)
- Read log data easily from logcat
- Debug applications, including breakpoints and heap monitoring
- Install and uninstall applications
- Access a stripped-down shell on the device, for command-line interaction.
...
More you can read for example here: http://android.stackexchange.com/questions/16250/what-is-usb-debugging-can-i-keep-it-on-foreverhttp://android.stackexchange.com/questions/16250/what-is-usb-debugging-can-i-keep-it-on-forever
jiseuo said:
Please read linked article, but short version is:
USB Debugging mode - special communication mode with other device. Used mainly by developers to debug new apps. It can be also used for hacking or modifying ROM files. Nothing for common users
Enabling USB debugging essentially starts up the adb daemon on your device, which allows it to communicate with adb on another device to enable debugging commands.
It's used when developing and debugging applications, and allows you (primarily) to:
- Transfer data between a computer and your device (both ways)
- Read log data easily from logcat
- Debug applications, including breakpoints and heap monitoring
- Install and uninstall applications
- Access a stripped-down shell on the device, for command-line interaction.
...
More you can read for example here: http://android.stackexchange.com/questions/16250/what-is-usb-debugging-can-i-keep-it-on-foreverhttp://android.stackexchange.com/questions/16250/what-is-usb-debugging-can-i-keep-it-on-forever
Click to expand...
Click to collapse
Yes i know but, that's not what i want.
bump
I think what you're looking for is a custom notification drawer background.....
Sent from my SCH-I535 using xda app-developers app

Enable Logcat in CM12 NIGHTLY Galaxy S4 jftlexx

Hi everyone! I'm trying to develop an app with Android Studio but whenever I try to check the logcat logs, nothing appears.
I have a Samsung Galaxy s4 with CyanogenMod Version 12.1-20150623-NIGHTLY-jfltexx installed. Android Studio is actually at version 1.3.2.
When I try to read app log messaes through Android Studio Device Monitor, I get the following error message:
DeviceMonitor: Adb rejected connection to client '11998': closed
When I try to manually launch Logcat from terminal using this command from the platform-tools directory:
adb logcat
I get the following error message:
Unable to open log device 'main'
I tried to find how to enable logging on my smartphone but I'm totally lost and I would really continue to develop my app.
Is anyone aware on how should I enable logging on my CM12?
Thank you so much in advance, I'm desperate
Diego
I have the same, have you found solution?

[ADB]How to whitelist a specific RSA fingerprint to connect via ADB?

Hi all,
Not sure if this is the correct subforum to post this (@mod please help to move if necessary )
I'm new to Android and I'm curious if this is possible? As adb commands would prompt a RSA fingerprint pop up on the Android device, is it possible that I could edit the source code of adbd and ensure that only a specific fingerprint is accepted to establish an ADB connection from a computer to the Android ?
So far , I have read through the source code of the master source code of adb from Google but I can't find the specific file to insert a if condition to limit only 1 specific RSA fingerprint allowed to connect from the client to the daemon installed on the Android device.
Or is there a method of restricting RSA fingerprinting without editing the source code?
I really do appreciate any help in this topic. Thanks !

[Resolved] How to successfully root PTCL Charji Wingle R660 and enable security and NAT features

Goal has been successfully achieved by a little bit of research and careful experimentation. Got to the middle of this post to find the complete solution.
I have a 4g Router Model: R660 also called 4g Wingle. The manufacturer is unknown as there is no branding on the device. But some say it is a GadgetIT product. I have scoured the internet and I cannot find the vendor named GadgetIT. But that is a separate discussion.
Main Goal: My main goal is to enable Virtual Server/Port forwarding in the device. The UI available when the device is connected is available at 192.168.1.1 with credentials admin/admin and Looks like this:
{
"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"
}
This device is marketed by ISP PTCL as CHARJI EVO . The users of PTCL charji on this forum might say that port forwarding is not possible in this device but I disagree. and I have evidence to support otherwise but again that is a separate discussion.
What I have found so far?
I am able to telnet to this device at 192.168.1.1 via admin/admin credentials. Here is what I get.:
Version
LNX.LE.4.1-41009-9x35
But admin is not root. There is a separate user called root which obviously has a different password. I have tried all common router password (not sure what all will constitute...but i have tried many).
The goal here is to root this device so that I can perform the necessary changes such as the following:
As you might have guessed by now, that i cannot unless I am root which I am not.
So I need your help guys. Here are other interesting things to look at:
I could edit mobileap_cfg.xml but I cannot because the file is readonly and I was unable to chmod it to 777 with an error message "Operation not permitted" indicating that I am not root and I can not make that happen.
The second thing i would like to do is to enable SNMP monitoring which I cannot do from the main interface because the vendor hid the option.
Lastly, enable firewall.
Interestingly, all these options are available in a tab called "Security" which the vendor has hidden from the configuration interface available at 192.168.1.1
So I am inviting the expert comments of all hackers that can help me make get it sorted out. Ideally, it would be awesome to have these options enabled from the UI (I am willing to hack, root this device and modify firmware if needed) to get this done.
This can potentially help millions of PTCL Charji Users who cannot run any kind of server using this device (including game servers) and any kind of listening services (sockets or WEB or FTP) r those who would like use torrents but suffer from terrible low download speeds on torrents because of not being able to open ports for incoming connections that significantly raise download speeds for torrent.
More details:
mobileap_cfg.xml ownership and permissions:
Appreciate your help. Waiting to hear helpful responses soon. Successfully rooted without any busy box.
Solution Achieved successfully- See Steps & detail as follows:
I was able to switch device to bootloader mode and was able to change root password and now I am able to switch to root mode when logged in via admin using telnet. I have successfully change the DMZ but i have yet to observe its effects. If it works, I will work on changing other values as well.
Detail:
The device closely resembles D-Link DWR 901 But mind you, it is NOT DWR 901. Even thought the radio matches, if you flash the firmware from DWR 901 (which will be successful), the device will NOT work. Since there is no available source of the original firmware of the device, the device will be of no use anymore. So do not do it.
Similary D-Link's DWM 222 is also similar to this device (only that DWM 222) is a 3G modem. I downloaded both firmwares and found out upon extraction of these firmwares, that it contains the following files.
Files that you actually need are present in this archive -
WARNING
Use at your own RISK!!. Flashing this directly to your Charji will brick you Charji device. So just follow the procedure I described and do not try to flash it directly otherwise it will render your device unable to connect even though everything will look all right in the software. The device will never connect again...ever!
https://www.dropbox.com/s/hqa2m4499pyrj3z/R660A-Donot-Flash-it-On-Charji-It-Will-Brick-Your-device.7z?dl=0
There is a file called dl.exe which can turn the device into download mode assumung you have the PTCL Charji Wingle R660 plugged into the USB port.
After that running adb devices command will list all the devices.
After that you need to run the following commands
Code:
adb shell
passwd
The adb shell command will take you to the shell.
The passwd command executed from shell will tell you to enter a new password for root user
You will have to provide a secure password for it to be accepted.
After that, it will update the root password.
exit the shell using the exit or quit command or simply close the command prompt.
Now, you can telnet to the device using the command
Code:
telnet 192.168.1.1
Login with username admin and password admin (if these are your credentials to access the router page, Use your credentials. Mine were admin/admin)
The issue the following command to switch to root mode
Code:
su
It will ask for root password. Enter the password you set using the adb shell you had used before. and viola. You will turn to root mode.
You you have two ways to fix the NAT/DMZ problem.
Either you can directly use the vi editor (my OpenEmbedded Linux OS installed on the device has only vi support) to edit the file mobileap_cfg.xml and update DMZ value and port forwarding values.
or you can enable the security tab by editing the menu.js file which is located in /WEBSERVER/www/ directory. Now I had a PTCL Charji R660. If you have a different device, your files will be located elsewhere with different sets of issues.
You can do whatever you want!
Older Updates
Update# 02:
DMZ is now working !!
Update# 03
Successfuly unlocked the hidden security tab but still untested. Will test it shortly.
Update # 04
Successfully unlocked Wizard
Update# 05
NAT Rules persisting and working, tested by download torrents and using CanYouSeeMe.ORG
Torrents Downloads working on max available speeds
Reserved 1
Reserved for additional instructions etc
Reserved 2
Good find but instructions are really ambiguous and unclear. What are you supposed to do with dl.exe? run it, stare at it, run it and press enter????
You are just trapping people into bricking their devices with this instruction.
Yes I am bad at providing instructions.
dl.exe once run, turns the charji into bootloader mode and then it is possible to run adb shell and adb commands.
Hope this helps. I will update the article to be more descriptive in future sometime. Don't have time right now.
Regards.
timematcher said:
dl.exe once run, turns the charji into bootloader mode and then it is possible to run adb shell and adb commands.
Click to expand...
Click to collapse
Ok you are still not being clear. What do you mean by run once? currently dl.exe shows
Code:
Welcome to use OnekeyUpdate Tool.
The Software to be updated:Desktop
Press 'Enter' to update or 'Q' to quit.
on opening. Should I press Enter?
Sorry about being rude in first comment. I am really angry right now over this device right now, what kind of stupidity is not allowing user to port forward.
raza1080p said:
Ok you are still not being clear. What do you mean by run once? currently dl.exe shows
Code:
Welcome to use OnekeyUpdate Tool.
The Software to be updated:Desktop
Press 'Enter' to update or 'Q' to quit.
on opening. Should I press Enter?
Sorry about being rude in first comment. I am really angry right now over this device right now, what kind of stupidity is not allowing user to port forward.
Click to expand...
Click to collapse
When you click Enter, it will say "Waiting for device...." and then "found"
That is the point the device will appear in device manager (on windows) as well. and Now is the time to run adb shell and corresponding commands in my first article.
Important thing to note is that if you have never rooted any android (or linux) based device/phone/tablet, I suggest you read more about running adb.
The goal of my article was the following:
1. reset root password on the OpenEmbedded Linux variant on teh charji wingle device
2. Login via Telnet to 192.168.1.1 (Charji web console) using admin/admin (default credentials of Charji)
3. change to root mode using su command
4. Be able to change the xml files ( i mentioned in the first post) that allow the user to create the firewall rules and virtual server entries.
Now at this point I did not know that the person who whitelabelled Charji wingle for PTCL simply had disabled the relevant code in menu.js that enabled the Virtual server entries and firewall entries and DMZ fields (that allow pot forwarding, open firewall or simply set an ip address for DMZ that opens everything to a single IP on charji local network).
Once I found out, I was really happy and now I created the virtual server entries for torrent which was my main problem.
Thanks to Dr.hack who created a proper tutorial on his blog based on information in this article in a more streamlined manner.
Dr. Hack's Blog, Root-hack-ptcl-charji-evo-nat/
thank you for the tutorial.I am trying it on a charji cloud R500A. when dl.exe finds the device it goes to "6% Downloading hex image" .Am i suppose to wait at this point?
And will i be able to use other sim on the the device after the root?
Tarar said:
thank you for the tutorial.I am trying it on a charji cloud R500A. when dl.exe finds the device it goes to "6% Downloading hex image" .Am i suppose to wait at this point?
And will i be able to use other sim on the the device after the root?
Click to expand...
Click to collapse
First things first!, Are you trying to flash the image from the firmware link I gave? You should really not do that!
The link i gave is only provided for firmware modding experts. It is not the firmware of Charji. So if you flash it, it will brick your device and it will become useless.
What you really need to use is th dl.exe file , copy it into a separate folder with no other stuff in it.
If you run it from the same folder, it will brick your device by flashing a firmware which will not work for your Charji. CHarji will never connect after that!
dl.exe must be run to turn the device into booloader mode, After that you have to run adb shell commands and make the necessary changes to reset the root user password.
I don't know if it will allow you to use another SIM or not. PTCL devices are usually NOT network locked. But again, this is not a tutorial for allowing the users to use another sim. It merely allows the user unlock Virtual Server, Firewall, DMZ settings and similar features which are hidden by PTCL.
And there is no such thing as "Telenet". Telnet is a client application in windows which is not installed by default. You will have to install Telnet Client from "Add Remove programs" in Windows. It is needed to access the device using the telnet protocol. Do some research on Telnet.
timematcher said:
First things first!, Are you trying to flash the image from the firmware link I gave? You should really not do that!
The link i gave is only provided for firmware modding experts. It is not the firmware of Charji. So if you flash it, it will brick your device and it will become useless.
What you really need to use is th dl.exe file , copy it into a separate folder with no other stuff in it.
If you run it from the same folder, it will brick your device by flashing a firmware which will not work for your Charji. CHarji will never connect after that!
dl.exe must be run to turn the device into booloader mode, After that you have to run adb shell commands and make the necessary changes to reset the root user password.
I don't know if it will allow you to use another SIM or not. PTCL devices are usually NOT network locked. But again, this is not a tutorial for allowing the users to use another sim. It merely allows the user unlock Virtual Server, Firewall, DMZ settings and similar features which are hidden by PTCL.
And there is no such thing as "Telenet". Telnet is a client application in windows which is not installed by default. You will have to install Telnet Client from "Add Remove programs" in Windows. It is needed to access the device using the telnet protocol. Do some research on Telnet.
Click to expand...
Click to collapse
Thank you so very much for the details.
Yeah i found out about telnet commands.but i was using the dl.exe in the same folder.i guess that's why adb devices wasn't able to find my device.
Luckily it didn't install that firmware.
I have bricked my device by accidentally runing the gui.exe and i was dont know that it will flash new firmware. is there any way to get back ?:crying:
If you are able to switch to fastboot mode and you have the original software in the right format, then you should be able to flash the new firmaware using the utilities provided in the original post. The only way I think. I will try to see if I can create an image for my Charji R660 but I can not promise anything.
Note that I bricked first of mine and I took it to the people who upgrade firmware of the device and they were unable to fix it. and I got a new one by being sneaky (and playing dubm) about it.
Or if you want to learn, maybe start experimenting a little bit but I think you will need the original firmware.
timematcher said:
When you click Enter, it will say "Waiting for device...." and then "found"
That is the point the device will appear in device manager (on windows) as well. and Now is the time to run adb shell and corresponding commands in my first article.
Important thing to note is that if you have never rooted any android (or linux) based device/phone/tablet, I suggest you read more about running adb.
The goal of my article was the following:
1. reset root password on the OpenEmbedded Linux variant on teh charji wingle device
2. Login via Telnet to 192.168.1.1 (Charji web console) using admin/admin (default credentials of Charji)
3. change to root mode using su command
4. Be able to change the xml files ( i mentioned in the first post) that allow the user to create the firewall rules and virtual server entries.
Now at this point I did not know that the person who whitelabelled Charji wingle for PTCL simply had disabled the relevant code in menu.js that enabled the Virtual server entries and firewall entries and DMZ fields (that allow pot forwarding, open firewall or simply set an ip address for DMZ that opens everything to a single IP on charji local network).
Once I found out, I was really happy and now I created the virtual server entries for torrent which was my main problem.
Thanks to Dr.hack who created a proper tutorial on his blog based on information in this article in a more streamlined manner.
Dr. Hack's Blog, Root-hack-ptcl-charji-evo-nat/
Click to expand...
Click to collapse
Hi dear friend how are you? I need original webui of PTCL Charji device For Huawei Ec8372u-876 device please can you share the link or any guidance for this
saqi755 said:
Hi dear friend how are you? I need original webui of PTCL Charji device For Huawei Ec8372u-876 device please can you share the link or any guidance for this
Click to expand...
Click to collapse
Or any other links of non modified original Loced Huawei firmware and Webui
Huawei Ec8372u-876 is a very good device compared to sh!t devices offered by PTCL before.
Here is what I have found on the web.
Its probably an unlocking solution and not a locked file.
I am in no way responsible for the quality of the file or the steps as I dont have this device and I can not test it before posting.
Please use these are your own risk. I at least downloaded the file and executed on local PC.
but that is pretty much it. Please use at your own risk.
PTCL Evo Charji Cloud
E5377u-872
How to Unlock Evo Charji E5377u-872
1: Battery Should be 100% Charged
2: Data Cable
3: A Pin
4. Unlocked file
Click to expand...
Click to collapse
Code:
www.mediafire.com/file/6td2bh12b4l6g9o/PTCL_charji_E5377u-872-www.hispeedsolution.com.exe/file
Process>>
1. Remove the battery from the device
2. Press & Hold Power Button + Reset Button on the same time after 5 seconds device will boot into download mode.
3. Connect to PC
4. Wait for drivers
5. After the drivers installed go to device manager & note down the port # namely appplication UI interface.
6. Run the *.exe file & enter the port # (E.g 19 or 20 or etc etc)
7. Let it flash the device, it will take about 5 minutes, after the flashing let the device reboot. Your device will stuck on the Huawei screen, Don't worry wait for 3 minutes then remove the battery insert any Sim card & turn on the device.
8. Your device is successfully unlocked on all network Sim.
9. Connect the device to PC & set up accordingly.
Click to expand...
Click to collapse
timematcher said:
Huawei Ec8372u-876 is a very good device compared to sh!t devices offered by PTCL before.
Here is what I have found on the web.
Its probably an unlocking solution and not a locked file.
I am in no way responsible for the quality of the file or the steps as I dont have this device and I can not test it before posting.
Please use these are your own risk. I at least downloaded the file and executed on local PC.
View attachment 5369881
but that is pretty much it. Please use at your own risk.
Code:
www.mediafire.com/file/6td2bh12b4l6g9o/PTCL_charji_E5377u-872-www.hispeedsolution.com.exe/file
Click to expand...
Click to collapse
Thanks for your cooperation but I need file for Ec8372u-876 this file is not working on this please check this again this is not a device with battery
Let me look into it.
timematcher said:
timematcher said:
Can we use other networks 4G in this device?
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Please reply if possible
sparking111 said:
Please reply if possible
Click to expand...
Click to collapse
Huawei 4G wingle should support other networks/SIMs once rooted.
I had a E8372h-608 4G wingle which was network locked to Telenor. After flashing it with network-neutral, universal firmware from huawei, it works for Ufone, Telenor, Warid/Jazz after appropriate AP configuration within the device UI.
Does that answer your query?

[APP][NON-ROOT] Termux-ADB - debug one Android device from another connected by USB-OTG

Run adb in Termux without root permissions!​This is a launcher for adb which enables debugging of one Android device from another via USB cable. It should work with any USB-C male-to-male cable or the corresponding OTG adapter + cable in case of micro USB.
https://github.com/nohajc/termux-adb
Motivation​Termux has had the android-tools package for some time now but it only works properly if you root your device (due to missing filesystem permissions). This is because Android has its own API for accessing USB peripherals which is incompatible with Linux. Termux already exposes this API using the termux-usb utility (part of Termux API) but this is not enough to make programs like adb work out of the box.
Usually you would have to modify any application which accesses USB devices but there's actually another way.
When you start adb using termux-adb, it will use termux-usb in the background for device discovery and then essentially feed the device information into adb by intercepting some libc calls and emulating usb device files as they would appear on any linux machine (bypassing the file permission problem entirely).
At this point the program is in its early stages and therefore highly experimental. I tested it on two Android devices so far and I can't give any guarantees it will work for everyone. But you can try.
That is great work! It works fine in my honor handset!
When will you share the new release with multiple ADB device support?
Appreciate for your fantastic tool !
It's definitely on my TODO list but now I'm also dealing with the fact it doesn't work on some devices.
So, I don't have an exact timeline but I'll keep this thread up to date.
Version 0.2 released today: https://github.com/nohajc/termux-adb/releases/tag/v0.2.0
@Stanton1011 It supports multiple devices now.
Thank you. If you're wanting feedback, there seems to be a lot of lag getting it to connect at first but it does work and once it's connected no issues. The fastboot however has much more lagging and will say simultaneously that commands succeeded and failed (but just seem to fail). But adb works fine on moto g pure running android 11, moto g pure on Android 12, TCL Obama phone type android 12, Samsung a11 android 10.
Thanks for the report. I'm aware of the lag. It's mainly caused by how Termux handles USB access in general but it could be improved if fastboot ran in the background (same as adb).
As for the commands failing, I'll look into it. Which particular fastboot commands you tried?
nohajc said:
Version 0.2 released today: https://github.com/nohajc/termux-adb/releases/tag/v0.2.0
@Stanton1011 It supports multiple devices now.
Click to expand...
Click to collapse
Thank you so much, I will have a try and let you know the result.
The following problem is solved by Pkg upgrade.
I find a error for it ,please help!
CANNOT LINK EXECUTABLE "./termux-adb": cannot locate symbol "_ZN6google8protobuf8internal14ArenaStringPtr3SetIJEEEvRKNSt6__ndk112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEPNS0_5ArenaE" referenced by "/data/data/com.termux/files/home/termux-adb"...
I have a handset with the root permission only for ADB, but Termux(or any android APP) can not obtain the root permission. Could you tell a way to use the adb in termux, I know I can user your github project Termux-adb as what you did before., but I also need a alternative way. I have the root permission of ADB command(by PC). Can I modify some folder permission to achieve the same affect?

Categories

Resources