I have an android application that works profectly on android<=13 but it’s not working on android 14. the error is Unable to connect to localSSHfd [/data/data/[Package_name]/xxxx/sshfd_file]
this is my sample code:
protected static final String BASE = "/data/data/[package_name]/xxxx";
String localSSHfd = BASE + "/sshfd_file";
int sshfd = 0;
MyLog.d(TAG, "Let's get sshfd");
LocalSocket clientSocket = new LocalSocket();
try {
LocalSocketAddress localAdd = new LocalSocketAddress(localSSHfd, LocalSocketAddress.Namespace.FILESYSTEM);
// localSSHfd should be created soon, let's wait a little bit to read sshfd
for (int i=0; i<20; i++) {
Thread.sleep(250); //Let's wait just a little bit before looking for file
try {
clientSocket.connect(localAdd);
}
catch (IOException ioe) {} //Let's ignore it a couple of times
if(clientSocket.isConnected()) break;
}
if(!clientSocket.isConnected())
{
MyLog.e(TAG,"Unable to connect to localSSHfd [" + localSSHfd + "]");
//Return an invalid sshfd
return sshfd;
}
whatever is, it’s related to android 14 (api lvl 34). anyone can help?