An easy way to change android application base url for debugging
implementation 'fun.yuner:serverhostchanger:last-version'
<dependency>
<groupId>fun.yuner</groupId>
<artifactId>serverhostchanger</artifactId>
<version>last-version</version>
<type>aar</type>
</dependency>
ServerHostChangeUtil.init(context, BASE_URL);
ServerHostChangeUtil.startChangeServerHostActivity(activity, REQUEST_CODE);
ServerHostChangeUtil.getCurrentServerHost(content);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {
//In order for the changes to take effect sometimes you should
//restart app like : System.exit(0);
}
}
Copyright 2019 ChenYun, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.