How to start Media Projection Service when Phone is reboot in android?

by kra.rd.test   Last Updated April 15, 2018 12:11 PM

When user install App in mobile, user needs give MediaProjection system service permisison to start screenshot feature. Whenever user restart mobile, user needs to give MediaProjection service permission every time. I want to make so user will need to give MediaProjection permission only once when App is installed on mobile so user doesn’t need to assign permission every time whenver mobile is started.

This code starts MediaProjection system service permisison when we manually enable permission:

 MediaProjectionManager projectionManager = (MediaProjectionManager) 
intent = projectionManager.createScreenCaptureIntent();

This code starts Service class when mobile restarts. So when service starts, it doesn’t set MediaProjection permission automatically.

 Intent myIntent = new Intent(context, ScreentshotService.class);
 myIntent.putExtra("code", code);
Tags : applications

Related Questions

Image and Video Files not showing up in Gallery

Updated April 08, 2015 18:04 PM