1

I'm working on cordova/ng4 ios application which contains personal data of users and I don't want old snapshot to be displayed when going back to application from multitasking or re-opening the application. Is it possible to set some kind of property in .plist file that will block keeping the snapshot? P.S. I also use UIApplicationExitsOnSuspend property which prevents application from running in the background.

Stan Reduta
  • 3,292
  • 5
  • 31
  • 55
  • There is a `UIApplicationDidEnterBackgroundNotification ` which you can listen to. If this notification is sent, you can make UI adjustments (hide personal data, etc.) before the snapshot is taken. Details can be found [in this support document from Apple](https://developer.apple.com/library/content/qa/qa1838/_index.html). Not sure how to do it in cordova, though. – Palle Jun 16 '17 at 12:37
  • This does not quite answer my question, I'm aware of states of application in iOS, but the problem is that I'm building app from config file and no settings can be done in swift or even plist file, because they'll be instantly overridden by cordova config. There's a way to add records to .plist file though directly from cordova. – Stan Reduta Jun 16 '17 at 12:44
  • cant u make use of the onPause and onResume events? – Sarantis Tofas Jun 16 '17 at 13:42
  • Not really, because there are many separate views that are not connected and I don't want to hard-code each of them to respond to system events. – Stan Reduta Jun 16 '17 at 13:47

1 Answers1

2

There are a few plugins that prevent screenshots or replace the snapshot of the app

https://github.com/devgeeks/PrivacyScreenPlugin

https://github.com/hellojianfeng/PrivacyScreenPlugin

https://github.com/lifeofcoding/cordova-blur-app-privacy-screen

Also, to write on the .plist, you can create a plugin and use the config-file tag

<config-file target="*-Info.plist" parent="KeyToWrite">
  //Values to write
</config-file>

Or use this one that allows you to do the same from the config.xml

Or create a hook

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • Thanks, and by the way, separate plugin is no longer needed for Cordova projects. Now it's possible to just add directly to config.xml – Stan Reduta Jun 16 '17 at 15:09
  • No, that's not true, only edit-config is supported right now and only for Android. On iOS no edit-config and not config-file is supported from the config.xml yet. – jcesarmobile Jun 16 '17 at 15:17
  • There is an issue open to add support, so maybe somebody implemented it and we didn't realize https://issues.apache.org/jira/browse/CB-11968 – jcesarmobile Jun 16 '17 at 22:13
  • If you made config-file work, why don't you answer your own question? https://stackoverflow.com/questions/44495518/add-custom-plugin-to-cordova-ios-app I would definitely upvote it – jcesarmobile Jun 16 '17 at 22:31
  • It doesn’t need to be up to date if it works. It’s not a complex plugin that needs constant updates – jcesarmobile Dec 12 '18 at 08:59
  • I tried all these plugins. It doesn't seems working. Any new updates? @jcesarmobile – Mohan Sep 26 '19 at 12:19