onNewIntent() is not called on ReactContextBaseJavaModule (react-native)

前端 未结 2 355
太阳男子
太阳男子 2021-01-14 21:21

I\'m building a react native module, from my module I send a PendingIntent like this.

Intent postAuthorizationIntent = new Intent(\"com.example.HANDLE_AUTHOR         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-14 21:56

    I had this same issue and fixed it by calling super.onNewIntent(intent) from MainActivity:

    @Override
    public void onNewIntent(Intent intent) {
        setIntent(intent);
        super.onNewIntent(intent);
    }
    

    With this in place, onNewIntent is called in your module - assuming your module implements ActivityEventListener and you've registered it as a listener in the constructor:

    reactContext.addActivityEventListener(this);
    

提交回复
热议问题