1

I am calling a BroadcastReceiver class using AlarmManager and Pending Intent. It is scheduled for daily basis.

The following is the code for BroadCast Receiver class which is called in the Activity(It is a separate class).

public class AlarmReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("Hello", "Hi");
        Intent mIntent = context.getPackageManager().getLaunchIntentForPackage("com.foodonz.android");
        if(mIntent!=null)
        {
            context.startActivity(mIntent);
        }
    }
}

The problem statement is that in this Receiver I am opening another application and I want to capture the screenshot and upload it to the server. But Window feature is not available in Broadcast receiver class and I cant implement as I am out of Activity control.

Key Challenge:

-Implement screenshot taking and uploading to server code in the following class

Any solutions for the same?

Rohit Mishra
  • 281
  • 5
  • 16

1 Answers1

0

You dont have access of window in broadcast receiver and in service dont let u take screen shot. So , in my sense in receiver you can open transparent activity and take screenshot in that activity. Following is the link to create transparent activity.

Create transparent activity

Let me know if its helpful or not.

Community
  • 1
  • 1
Hassan Munir
  • 419
  • 7
  • 24