简体   繁体   中英

Hook to BroadcastReceiver using Xposed Framework

How to hook a onReceive method inside BroadcastReceiver?

public class RecentsActivity extends Activity
{
  mIntentReceiver = new BroadcastReceiver()
  {
    public void onReceive(Context context, Intent intent)
    {
      ...
    }
  };
}

Since the BroadcastReceiver is an abstract class and this is an inline class definition, perhaps you can retrieve this BroadcastReceiver this way:

for(Class<?> cls : <package_name>.RecentsActivity.class.getDeclaredClasses()){
    if(BroadcastReceiver.isAssignableFrom(cls)){
        //hook onReceive
    }
}

Otherwise try to check the application smali code using the apktool .

There probably is a file named RecentsActivity$N (where N is a number). Just do Class.forName("<packagename>.RecentsActivity$N") and hook this class onReceive method.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM