Hi Dw
I'm planning to create an application for mobile phone, now my problem is that I've never done this before and I don't know the filing or the root files of a mobile device but I use to hear that it also has a 'c:\' drive which is good for this application I'm planning but the problem is that I don't know if a file named etc exist on a mobile phone or not, the application that I'm planning will be the add or it will come with my program for windows pc and I'm trying to enable the feature of controlling the web access which will limit or block certain websites from being accessed by the device, in windows pc I used that file for controlling so was thinking of using it too on mobile device if it do have the file c:....\etc\host and also how can I explore these file on my computer let say I connect a phone with a cable which program should I have and if the file exist does all the smartphones have it and is it located the same root from symbian, android, blackberry, etc? Thank you.

Dani AI

Generated

Thread summary for (and follow-up from ): there are two practical ways to block or limit web access from a phone — change the device’s system image (requires elevated privileges) or intercept/filter network traffic from an app running in user space. For a first project that must run on normal, non-rooted phones, the user-space/network approach is far easier to ship and maintain.

A common no‑root pattern is to implement a local VPN service inside the Android app and apply rules there — that lets the app see outbound connections and block by IP, domain, or package without needing system write access. The Android VPN API is the supported entry point; a tiny skeleton looks like this:

public class MyVpnService extends VpnService {
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    Builder b = new Builder();
    b.addAddress("10.0.0.2", 32);
    b.addRoute("0.0.0.0", 0);
    ParcelFileDescriptor vpn = b.establish();
    // read/write vpn.getFileDescriptor() to inspect/forward packets
    return START_STICKY;
  }
}

See the official VpnService docs and study an open-source example such as NetGuard for real-world patterns. (developer.android.com)

If you can assume rooted devices or an enterprise-managed fleet, a system‑level approach (kernel rules / iptables or editing system host entries) is possible and more global. Rooted firewalls like AFWall+ show how iptables rules are used on Android. For low-level exploration from a PC, developer tools such as the Android Debug Bridge (adb) are the right way to inspect and pull device files when you have permission. (github.com)

A practical note about USB: connecting a phone to Windows usually exposes media/storage via MTP, not the system partitions, so you won’t see system files that way — developer tools or root access are required for that level of access. For shipping a Windows companion app, prefer a secure sync channel (local Wi‑Fi or authenticated API) that sends rule lists to the VPN/filter app on the phone. (developer.android.com)

Troubleshooting tips: test rules on mixed Wi‑Fi and mobile data, remember HTTPS limits content-based blocking without TLS interception (which requires user consent/installed CA), and prototype with NetGuard/Blokada to learn the VPN-filter pattern before writing low-level packet code.

Recommended Answers

All 5 Replies

Similiar to linux, an Andoid will mount a filesystem to / (and others) to access the files within. C:\ is a DOS/Windows invention. So to etc/hosts will usually be found at /etc/hosts.

Thank you but I've never used Linux OS I'm using windows but I think the approach is more the same to rooting files but I'm not sure of that, in windows I can access this file by 'C:\Windows\System32\drivers\etc\hosts' how will or what is the full path to this file in android and symbian because I don't think they have 'windows\System32\' and also how can I explore this on a computer when I've connected the phone to a computer so that I can make sure that I get the correct and accurate path to this file. Thank you

In Android, the hosts file is located at /etc/hosts

I can't find the path even if I point the DOS to Drive f:/ where my phone is at but the command prompt says can't find the path. Any help?

You can't do this on a phone mounted like a usb disk. You must turn on dev options and use adb to access the phone. Or use a file manager (i think you may need root for this) and on the phone look for /etc/hosts

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.