https://developer.android.com/training/building-wearables.html

standalone adj. 單獨的

With the introduction of standalone Wear apps, both the watch and the phone can be sources of notifications. Use the NotificationCompat.Builder class to create notifications for wearables. When you build notifications with this class, the system takes care of displaying notifications properly, whether they appear on a watch or phone.

隨着獨立應用程序的引入,手錶和手機都可以成爲通知的來源。使用NotificationCompat.Builder類創建可穿戴設備的通知。當您使用這個類構建通知時,系統將正確地顯示通知,無論它們是出現在手錶或電話上。

Notifications using RemoteViews are stripped of custom layouts and the wearable only displays the text and icons. However, you can create custom notifications that use custom card layouts by creating a wearable app that runs on the watch

stripped adj. 剝去的
通知在手錶上只顯示text和icon,但是你可以設計針對手錶的佈局。

int notificationId = 001;
// The channel ID of the notification.
String id = "my_channel_01";
// Build intent for notification content
Intent viewIntent = new Intent(this, ViewEventActivity.class);
viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
PendingIntent viewPendingIntent =
        PendingIntent.getActivity(this, 0, viewIntent, 0);

// Notification channel ID is ignored for Android 7.1.1
// (API level 25) and lower.
NotificationCompat.Builder notificationBuilder =
    new NotificationCompat.Builder(this, id)
        .setSmallIcon(R.drawable.ic_event)
        .setContentTitle(eventTitle)
        .setContentText(eventLocation)
        .setContentIntent(viewPendingIntent);


// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
        NotificationManagerCompat.from(this);

// Issue the notification with notification manager.
notificationManager.notify(notificationId, notificationBuilder.build());

substantial adj. 大量的;實質的;內容充實的

發佈了46 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章