Как получить Выпуск Vista программно?

Вы можете использовать «Дооснащение». Подписывайте устройства для обсуждения новостей. Отправить уведомление от одного устройства к другому.

public void onClick(View view) {

    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BODY);

    OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
    httpClient.addInterceptor(new Interceptor() {
        @Override
        public okhttp3.Response intercept(Chain chain) throws IOException {
            Request original = chain.request();

            // Request customization: add request headers
            Request.Builder requestBuilder = original.newBuilder()
                    .header("Authorization", "key=legacy server key from FB console"); // <-- this is the important line
            Request request = requestBuilder.build();
            return chain.proceed(request);
        }
    });

    httpClient.addInterceptor(logging);
    OkHttpClient client = httpClient.build();

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("https://fcm.googleapis.com")//url of FCM message server
            .client(client)
            .addConverterFactory(GsonConverterFactory.create())//use for convert JSON file into object
            .build();

    // prepare call in Retrofit 2.0
    FirebaseAPI firebaseAPI = retrofit.create(FirebaseAPI.class);

    //for messaging server
    NotifyData notifydata = new NotifyData("Notification title","Notification body");

Call<Message> call2 = firebaseAPI.sendMessage(new Message("topic or deviceID", notifydata));

    call2.enqueue(new Callback<Message>() {
        @Override
        public void onResponse(Call<Message> call, Response<Message> response) {

            Log.d("Response ", "onResponse");
            t1.setText("Notification sent");

        }

        @Override
        public void onFailure(Call<Message> call, Throwable t) {
            Log.d("Response ", "onFailure");
            t1.setText("Notification failure");
        }
    });
}

POJOs

public class Message {
String to;
NotifyData notification;

public Message(String to, NotifyData notification) {
    this.to = to;
    this.notification = notification;
}

}

и

public class NotifyData {
String title;
String body;

public NotifyData(String title, String body ) {

    this.title = title;
    this.body = body;
}

}

и FirebaseAPI

public interface FirebaseAPI {

@POST("/fcm/send")
Call<Message> sendMessage(@Body Message message);

}
5
задан Dukeling 12 October 2013 в 10:39
поделиться

3 ответа

MSDN дает обширный ответ:

Получение версии системы

5
ответ дан 14 December 2019 в 13:52
поделиться
[Environment.OSVersion][1]
1
ответ дан 14 December 2019 в 13:52
поделиться

Замечательно! Это, в чем я нуждаюсь также. Спасибо aku.

edg: Среда. OSVersion содержит строку версии, но это обычно не дает достаточно информации для дифференциации, выпуски (также относится к Дому/XP XP Pro). Кроме того, существует риск, что эта строка будет локализована настолько соответствующая на нем, woudn't обязательно работают.

0
ответ дан 14 December 2019 в 13:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: