How to Prevent Screen Recording and Screen shoot in Flutter App?

42 views
Skip to first unread message

Alpesh

unread,
Jul 28, 2019, 10:02:53 PM7/28/19
to Flutter Development (flutter-dev)

But it worked some mobile only. 

Not worked Chinese mobile like Xiomi y1 lite, Redmi note 4, Cool Pad etc screen recording inbuilt functionality. 

I developed Educational Video courses App. 

So I want someone not copy my video. 
I want prevent screen recording in all mobile device. 
It’s possible on Android. But I developed in Flutter. Please help."


My Code :



import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugin.common.StringCodec;
import io.flutter.plugins.GeneratedPluginRegistrant;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

import android.content.Context;
import android.app.KeyguardManager;
import android.view.WindowManager.LayoutParams;

public class MainActivity extends FlutterActivity {
  private static final String CHANNEL = "www.example.com/info";

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
    getWindow().addFlags(LayoutParams.FLAG_SECURE);

    new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(new MethodCallHandler() {
      @Override
      public void onMethodCall(MethodCall call, MethodChannel.Result result) {
        if (call.method.equals("getDeviceStatus")) {
          KeyguardManager keyGuardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
          result.success(keyGuardManager.inKeyguardRestrictedInputMode());
        }
      }
    });
  }
}
Reply all
Reply to author
Forward
0 new messages