How to Open specific component in android activity?


#1

i want to publish android lock screen.
but now i can’t find how to call specific react native js component from Android Receiver Class(intent start activity).

-> i did ‘detach expo’

previous question


#2

Hey @jb9229! You might want to read this section of the React Native docs: https://facebook.github.io/react-native/docs/native-modules-android.html#sending-events-to-javascript


#3

Thax @jesse

you mean send ‘JS Component View Open Event’ message to js?

it is my fault to open js component at android service,

now i am success to receive screen off event

    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
        {
            if(telephonyManager == null)
            {
                telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
                telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE);
            }


            if(isPhoneIdle)
            {
                WritableMap params = Arguments.createMap();
                reactContext
                        .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                        .emit("LockScreenOpen", params);
            }
        }
    }
DeviceEventEmitter.addListener('LockScreenOpen', function(e: Event) {
    // handle event.
    console.log("== Debug: Received LockScreen View Open");
  });

but JS Listener need to background service

so now i am solving a problem

is any advice?


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.