我是新手。我想问一下是否有可能在改造链接中添加固定值的数据。
这是我的代码:(这里我有一个值,该值从我的模块中获取我的用户ID。)
public class ScheduleModule extends Fragment {
public static String qqst;
View inflatedView = null;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
inflatedView = inflater.inflate(R.layout.fragment_schedule_module, container, false);
ggst = Settings.Secure.getString(getContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
,我想在我的api上添加此代码。通过将数据传递到链接,但无法正常工作。
public interface API {
@GET("api/Database/GetSchedule?
serialNumber="+"Schedule.ggst")
Call<List<ScheduleDetails>> getSchedData();
}
Schedule.ggst
无法将数据从我的模块链接到api。但就我而言,这就是我想要做的,以便在每台设备上对我的自定义api都有唯一的ID访问权限。
这是我要访问的示例数据:
api/Database/GetSchedule?serialNumber=5d2a2dd4c787e116
答案 0 :(得分:0)
我认为您可以使用如下查询参数
@GET("api/Database/GetSchedule)
Call<List<ScheduleDetails>> getSchedData(@Query("serialNumber") int serialNumber);
并这样称呼
APIService.getSchedData(ggst);