Expo and native android app communication issues

#1

I have 2 apps.: 1. An expo app 2. Native Android app.

My use case is that I want the expo app to open the android app, and the android app to send the result back to expo.
I am able to open the android app from the expo app, no issues there.
But when I try to communicate the result from android to expo, the expo app restarts. When I build an APK from the expo app everything works fine and the expo app receives the result from android.

How do I solve this? A lot of development time is wasted in building an APK from expo and checking if things work fine.

0 Likes

#2

Can you provide some more detail on how you’re opening one app from another? From both directions

0 Likes

#3

One thing you could do is detach and build the expo app yourself – that might save some time.

I think the Expo app may be restarting bc your device is running low on memory when the Android app starts and so it kills the Expo app.

If you didn’t see this already, here are the docs about linking to your app.
https://docs.expo.io/versions/latest/guides/linking.html#linking-to-your-app

0 Likes

#4

This is how I call native android from expo:

Linking.openURL(url).catch(err =>
        console.error("An error occurred", err)
);

This is how I send the result back to expo:

Intent intent = new Intent();
String res = "exp://192.168.1.91:19000?path=" + image.getAbsolutePath();
intent.setData(Uri.parse(res));
startActivity(cameraIntent);
0 Likes

#5

Read the section on passing data to your app through the URL here:
https://docs.expo.io/versions/latest/guides/linking.html#expoconstantslinkinguri

You need a + before the data and probably want to use the LinkingUri constant.

0 Likes