根據你的代碼,你似乎在使用Android的Azure NotificatonHubs SDK來實現你的需求,所以請查看它的javadocs在here。
按照javadoc & source code適用於Android天青NotificationHubs SDK的Registration
類,不存在用於設置ExpirationTime
從NotificationHub
對象更新的Registration
對象中的任何公共方法。所以無法在android端設置到期數據。
但是,您可以嘗試使用適用於Java後端的Azure NotificationHubs SDK來執行此操作,請參閱位於here的後端javadocs。
作爲參考,這裏是一個示例代碼。
String connectionString = "<your connection string>";
String hubPath = "<your hub path>";
NotificationHub hub = new NotificationHub(connectionString, hubPath);
// Get the registration by Id
String registrationId = "<your registration id>";
Registration registration = hub.getRegistration(registrationId);
// Set the expiration date
Date expirationTime = new Date(....);
registration.setExpirationTime(expirationTime);
如果你有在Android端設置過期數據,我的建議是,你可以嘗試使用通知集線器REST API Create or Update
與物業registrationTtl
做到這一點。
不[此asnwer在Azure的通知集線器註冊更新過期時間(http://stackoverflow.com/a/39420197/182371)幫助? –
@NikitaG。對不起,這個答案不會幫助我。 – Sangeetha