看了迁移文档后,似乎它预设了我的整个构建环境(gradle、插件、库)是最新的。但在我的情况下,它们已经有五年的历史了,我没有升级任何一个,因为我绝对不相信我不会陷入到构建失败的地狱中。此外,这是一个我将在今年晚些时候用PWA替换的应用程序,因此迁移不需要具备未来性或使用任何新功能。
因此,我正在寻找最小的迁移步骤,以避免应用程序出现问题。我认为我已经掌握了接收端,但需要关于注册和发送的建议。
我的当前代码是:
// REGISTRATION
gcm = GoogleCloudMessaging.getInstance(context);
MyLog.d("[G152] about to register with gcm...");
regid = gcm.register(SENDER_ID);
msg = "Device registered, registration ID=" + regid;
// SENDING
final String API_KEY = "AIzaAt-kduR...xDass";
URL url = new URL("https://android.googleapis.com/gcm/send");
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("https://android.googleapis.com/gcm/send");
httppost.setHeader("Content-Type", "application/json");
httppost.setHeader("Authorization", "key=" + API_KEY);
StringEntity body = new StringEntity(new Gson().toJson(gcMessage));
httppost.setEntity(body);
HttpResponse response = httpclient.execute(httppost);
我需要进行哪些最小更改才能进行迁移?