Showing posts with the label Android

Log exception to file in c# .net core application explained

In production environment when any bug gets reported at that time as developer wants to get the exception details of bug to resolve the issue on high priority.
In some case there might be situation where exception is not logged in table but developer wants to check the bug immediately. for that purpose we need to write the
exception details including stack trace of bug in file. To implement this easily i am going to demonstrate the implementation of custom logging in file as below.

First we need to construct the exception and logger method in custom logger class as shown below.

public class CustomLogger { public static List<string> ConstructExceptionDetails(Exception ex,string FunctionName) { return new List<string>() { $"{DateTime.Now} - {FunctionName}", $"Exception: {ex.Message}", $"StackTrace: {ex.StackTrace}", $"InnerException: {ex.InnerException?.…

Move all apps to sd card in Android by using adb interface setting

I have experienced all apps in android device not moving to sd card and  this leads to out of space the phone memory. To deal with this we can set default installation location to sd card. To achieve this we need to use adb interface and some commands.
Before using this trick you need to download the SDK package from android . Once you have the SDK you can find the adb tool in /platform-tools/, though in my case I have it at /tools/.
After you’ve installed the SDK you’ll need to connect your phone to your computer using the USB data cable. You’ll also need to make sure that debugging is possible by visiting “Settings -> Applications -> Development” and checking “USB Debugging”.
To change the the install location we are going to run the pm command via the adb shell. Here’s the details of the pm command:

The setInstallLocation command changes the default install location 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external…

Root your Gingerbread 2.3.4 android Mobile Phone

Root your Gingerbread 2.3.4 android Mobile Phone with following steps. before you start you have to download some files from here and follow the steps below

 Put the phone in Debug Mode: Go to Settings > Applications > Development and check USB debugging box. Extract the files from the zip below, connect the phone via USB, and copy them to the phone via ADB like this: Code:
adb push Superuser.apk /sdcard/Superuser.apk adb push su /sdcard/su adb push busybox /sdcard/busybox adb push exploit.bin /data/local/tmp/exploit.bin
Now we enter the phone's internal shell, also using ADB: Code:
adb shell
Then we take advantage of the "fake" root exploit: Code:
cd /data/local/tmp chmod 0755 exploit.bin ./exploit.bin
Now after that last command you should be back to your normal console, not the phone one, so we need to connect to it again, and doing so we should now see that we have root permissions since the "#" symbol is displayed instead of "$". Code:
adb sh…

Proxy settings in android phone

Hi all, here i am going to demostrate about the proxy settings in android phone.
As there is no UI for proxy settings for android web browser.
But the android web browser will read the proxy settings in its settings database.
Here is the instructions to enable the proxy in the android web browser.
to do this setting you must download SDK package from android

you need to check USB Debugging option in phones setting

and follow the step given below

> adb shell # sqlite3 /data/data/ sqlite> INSERT INTO system VALUES(99,’http_proxy’, ‘proxy:port’); sqlite>.exit You can talk to settings.db for more information. sqlite> SELECT * FROM system; sqlite> .tables sqlite> .databases sqlite> .schema table_name sqlite> more SQL expression to talk to the tables Don’t forget the ‘;’ at the end of the SQL expression.