This is a broad question with several possible answers, but in the end it is up to you decide how want to handle app usage.
Mobile apps are install and granted permissions by the operating system. The user is often prompted to allow these permissions when they install or update the app. Analytics falls under the category of app permissions for network traffic. If users have already granted your app these permissions then you should be able to add it without notifying the user.
If your app does not have network permissions they will be prompted to grant those permissions next time they update the app, or they can choose not to update.
I would argue that the user has granted permission for you to collect data the moment they grant network access.
If you want finer grain control over permissions you have to implement that yourself, but keep in mind that this is purely cosmetic at this point. You can ask the user permission to collect analytics but as you've pointed out any tech-savy user can monitor the traffic to see if you're enforcing the permission.
The problem with this approach is that is it highly opinionated. They user can opt-out of analytics and then criticize every piece of network packet as being personal information.
When you ask the user the question "Allow us to collect anonymous data?" it generally open the door to the user's wildest imagination about what that data could be.
Some analytic services use a mobile devices unique identifier to track users. While the ID is not associated with personal information a user may not view it that way.
Instead of granting permission for a feature. You should cover all future changes under the terms and conditions of a user agreement. Within it you would state what types of network traffic the user is granting by accepting those terms, and what risks and liabilities they are accepting.
You are not only asking permission to collect analytics, but also protecting yourself from legal action on the part of the user for collecting said data.
Example; you could push an update to the iOS store that contains a bug. This bug enables analytics for users who have opt-out of the feature. Without the user agreement you would be liable for user damages.
A user agreement can protect you by defining the terms of usage, liabilities and risks of using your software.
There are websites that offer boilerplate or procedural user agreements.
Just google "legal agreements for mobile apps".