Capture network traffic programmatically (no root)

前端 未结 1 891
别跟我提以往
别跟我提以往 2021-02-02 15:25

I\'m trying to find resources or library which could permit me to capture the traffic of all the network packets of a device programmatically either it be from wifi or mobile ne

1条回答
  •  无人及你
    2021-02-02 16:07

    The de-facto appraoch to packet sniffing in Android without root is loop-back VPNService. Creating a VPNService app and activating it, will force all traffic in the device to go through your newly created virtual interface which is managed by a userspace application, where you will be receiving IP Packets by reading from the virtual interface.

    You can check a simple code sample for it from Google here

    You can check a full working example project here

    0 讨论(0)
提交回复
热议问题