37
Views
14
Comments
Solved
Screen capture lock on mobile application
Question

Hi guys!

I need to block the screen capture of a specific screen or block in mobile applications, does anyone know how I can do this block? 

I saw the plugin Privacy Screen Plugin, but it doesn’t serve me, I need to block it on both Android and iOS.

thankful

Rank: #172
Solution

Murilo,

I just added some more functionality and changed the way of using it check in the Component page:


What’s new (1.0.1)

Updated the way of using it.
Now you set the default behavior you want for all your application. Using the OnApplicationReady:


Then you can override the option is default screens using the OnInitialize and OnDestroy of this giving screen.

For example, let's just enable the  screen shot functionality for just one screen.

In the screen OnInitialize function we place:

This will enable the functionality.

Then to go back to the default behavior we need to Disable it again on the On Destroy.

So on the OnDestroy action of that screen, we place:



You can keep the default behavior as you want, to enable or disable it for all app, and override it for just one specific screen.

This way you may be able to either, disable this functionality to all app in an easy way or let it enabled for all app and just block in a specific screen


Rank: #172
Solution

Hi Murilo,

I also didn't find any plugin for both platforms in Forge, so I just made one for you...


Since you need it quickly I uploaded it with just one function, to prevent the user to take a print for one screen.

I tested in android and it is working.


Here it is

To use it, just place DisableScreenShot action on the OnInitilize of the screen you don't want the user to take the print, like this:



In future I will improve it and make it better looking.

Just added ASAP so you can use it.


I did not tested in iOS but it also should work.


Also it will work just in the native apps installed in devices, you will not be able to test ir in Browser or PWA.


Let me know if you have any issue with it.

Hope it helps,

Cheers and Regards,

RR :)

Champion
Rank: #106

Hi Murilo,

The  Privacy Screen Plugin is a mobile native plugin. It works on both the iOS and Android. 

Also, have a look at https://success.outsystems.com/Documentation/10/Delivering_Mobile_Apps/Customize_Your_Mobile_App/Use_Custom_Splash_Screens

Regards,

Swatantra

Rank: #172
Solution

Hi Murilo,

I also didn't find any plugin for both platforms in Forge, so I just made one for you...


Since you need it quickly I uploaded it with just one function, to prevent the user to take a print for one screen.

I tested in android and it is working.


Here it is

To use it, just place DisableScreenShot action on the OnInitilize of the screen you don't want the user to take the print, like this:



In future I will improve it and make it better looking.

Just added ASAP so you can use it.


I did not tested in iOS but it also should work.


Also it will work just in the native apps installed in devices, you will not be able to test ir in Browser or PWA.


Let me know if you have any issue with it.

Hope it helps,

Cheers and Regards,

RR :)

Rank: #172
Solution

Murilo,

I just added some more functionality and changed the way of using it check in the Component page:


What’s new (1.0.1)

Updated the way of using it.
Now you set the default behavior you want for all your application. Using the OnApplicationReady:


Then you can override the option is default screens using the OnInitialize and OnDestroy of this giving screen.

For example, let's just enable the  screen shot functionality for just one screen.

In the screen OnInitialize function we place:

This will enable the functionality.

Then to go back to the default behavior we need to Disable it again on the On Destroy.

So on the OnDestroy action of that screen, we place:



You can keep the default behavior as you want, to enable or disable it for all app, and override it for just one specific screen.

This way you may be able to either, disable this functionality to all app in an easy way or let it enabled for all app and just block in a specific screen


Rank: #172

Hi Murilo,

You tested it with a generated IPA or from browser?

Rank: #172

Murilo,

I will try to get any Iphone where I can test it for you...

Will let you know about any updates... It should work...


Rank: #172

Hi Murilo, 

I searched a little bit deeper on this.

And even if the cordova plugin says it supports iOS on the GitHub... I think it really does not.

I found some posts in Stack Overflow saying that it os not possible to prevent a screenShot in an iOS device. See:


Even Snapchat can't do it and tried other solutions like this one above using the touch event (Which also is no longer valid). Now you can just be aware that the screenshot was taken, and show something for example or warn the User.


I think this functionality of warn the User that is supported by the plugin I used, and I can try to implement it with some event callback to you do something if user take a screenshot in iOS. Let me know if this would help.


The only thing I found that could not prevent but at least change the print, is this plugin you tried ScreenPrivacy, and another one that blurs the image, but don't prevent the User from taking it. If this would work for you I can also try to implement it in another component... Let me know.


I'm sorry that this one I implemented didn't work for iOS, since it was saying to support All iOS versions I was Hopeful!


Cheers and Regards,
RR :)


Rank: #172

Hi Murilo!
I'm sorry for the delay, things have been busy around here but I have some news!


I checked the plugin code and seems like it have the function to detect screenshot on iOS by default, so I just adapted it so you can use in your Mobile Apps using the component.


However it had not this functionality for android, and since I think things must be equal whenever possible I researched a little bit and developed it also for android.


I will explain what I did for your knowledge.

First I had to clone the original github and make some changes.

Through these two stack overflow topics I was able to see how to implement this in Android and how I could adapt it to cordova:

https://stackoverflow.com/questions/31360296/listen-for-screenshot-action-in-android

https://stackoverflow.com/questions/54939027/triggering-javascript-event-from-android


However since Android don't have a default event for taking a ScreenShot, the option commonly used (Even by Snapchat) is to create an observer that keep checking if while the app is opened any file created have the name 'screenshot'.


Personally I don't think it is a very good way to do it, but is the only option I found. And looks like the Big Ones (Like Snapchat) also use it, so I accepted it for now at least :)


Since it needs to check for new files you will need the permission to Read External Storage, which is handled by the app.


 I made this option in android optional, so you can choose to use it or not.


Right now in the app you will be able to: 

-Prevent the user from taking screenshots in android only.

-Detect a screenshot taken by an User in both, iOS and Android.

-Set the default behavior for all app or for a specific screen

-Set the default callback for all app or for a specific screen


I added a sample module in Component Page, so you can see how to use it.


Let me know if it worked well.


Cheers and Regards,

RR :)


Rank: #172

Hi Murilo!

Were you able to solve your issue?

Let me know if the plugin worked as expected if you used ;)

Tkss

RR