How to enable adbd to listen on port during boot in Android?

I have an entrenched HTC Hero and I want to do this in order to enable adbd to listen on the port at boot time.

I tried to find the code here :

setprop service.adb.tcp.port 5555 stop adbd start adbd 

in the Android shell and it works great.

I tried to modify the init.rc file. I added the code above to init.rc and I replaced it with the original file using the following commands:

 adb push init.rc sdcard adb shell adb su mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 / adb cp sdcard/init.rc / 

The file was successfully replaced, but when I restart my phone and try to connect via:

 adb connect <IP>:5555 

connection is not established.

Any ideas?

(PS. I do not want to use the remoteADB application and the shell command, for example am start -n ... )

+8
android adb boot init
source share
3 answers

This will make it permanent:

 setprop persist.adb.tcp.port 5555 

After rebooting, ADB via USB may not be available. To cancel this setting, follow these steps:

 setprop persist.adb.tcp.port "" 
+24
source share

You need to unzip, modify and repack initrd in boot.img. Further information can be found at:

https://groups.google.com/forum/?fromgroups=#!topic/android-platform/w37x_WCrhMM

+1
source share

Why don't you try using BroadcastReceiver for the BOOT_COMPLETED action?

You can register it in your manifest:

  <receiver android:name="com.myapp.BootCompleted" android:enabled="true" android:exported="false" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> 

and in the class, you can do whatever you want when the download is complete:

 import java.util.*; import android.content.*; public class BootCompleted extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Do the actions you want } } 
0
source share

All Articles