How to share ApplicationToken with DeviceAcvivityMonitorExtension

To shield applications, we have to pass ApplicationTokens to DeviceAcvivityMonitorExtension. But I don't know the way.

I tried to pass it by using NSUserDefaults. However, it didn't work because ApplicationToken isn't encodable. So I can't save it in UserDefaults

Does anyone knows the way to pass ApplicationTokens to the Extension or another way to shield apps?

ApplicationToken is encodable, please see Encoding a Token for more information. Also, you must make sure to use UserDefaults that are shared between an app and its extensions via App Groups.

@toshi2001 were you able to get this working as im having the exact same issue All very well saying encode but encode(to: what ? and then how to decode

If you figured it out some help here would be greatly appreciated

Thanks

How to share ApplicationToken with DeviceAcvivityMonitorExtension
 
 
Q