简体   繁体   中英

Android app with test flag

I want to run the same android code, but select test server or production server at runtime based on some setting.

My first idea was to detect if my IP address is a "10.xxx" address and run according which is working, but it occurs to me that my live users may want to run on their 10. network too and thus break my app.

How can I accomplish this?

I guess that will work for your scenrio

Try with your device id it's unique for devices

I would use flavors. ie you can use "mock" and "prod" flavor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM