Any way we can persist a variable's value in Notification Service Extension

Is there a way somehow to persist a variable's value in NSE in subsequent push notifications.
Suppose i got a Bool variable which is by default false, now i got a push notification and i set this variable's value to true.

Is there a way if next time my push triggers i will be able to retrieve my variable's value i.e i get true ??
Could you save this value in user defaults for instance ?
Yes. You could use UserDefaults within NSE target or enable App Groups and save data there, then both app target and extension target can access the data.
Any way we can persist a variable's value in Notification Service Extension
 
 
Q