Comments (9)
@benjie, thanks anyways.
FYI, I have this working and can put together a tutorial if anyone gets to this message and needs clarification. I have only developed iOS so far, but the goal is both platforms
from react-native-share-extension.
@parkerdan
Please share the tutorial with me in any way preferable for you.
from react-native-share-extension.
I just used https://github.com/oblador/react-native-keychain to share credentials between the share extension and the main app; there's two important things to note:
- react-native-keychain defaults to a "service" of the identifier of the app, which differs between the app and the extension. Thus you must explicitly set them to be the same via the
service
option. (Took me longer than I'd like to admit to figure this out.) - you should set the Keychain Access Groups in both the app and the extension to be an array with just one value which should be the exact same string, which should be prefixed with
$(AppIdentifierPrefix)
.
from react-native-share-extension.
Just found this issue here when I was struggling with the same. I got it working by the steps described below. Hope this helps others!
Bundle Identifier used in this example: com.example.appname
(use the one from your Main App)
-
Make sure you have a App Group set up in your main App and Extension. They need to have the same name, for example:
group.appname
-
Make sure your main App and Extension have "Keychain Sharing" enabled. The Keychain Group need to be the same, for example:
keychainGroup
. -
Then, use the method's like this:
const credentials = await Keychain.getGenericPassword({ accessGroup: 'group.appname', service: 'com.example.appname' });
await Keychain.setGenericPassword('username', 'password', { accessGroup: 'group.appname', service: 'com.example.appname' });
The service
(Bundle Identifier) option seem to be required in this use case with an extension.
Thanks @benjie for pointing that out.
from react-native-share-extension.
@shishircc, No, Share Extension have no access to main app, even thought they are bundle together. I have created a new project called react-native-swiss-knife which created a pipe between share and main app. Take a look at the Bucket api inside that project. You don't have to use it but this is what I'm doing for sharing data between them.
from react-native-share-extension.
Thanks !
from react-native-share-extension.
You can use a shared filesystem. With iOS app groups can share a directory where you could store your database. I've recently had a PR accepted to react-antive-fetch-blob that adds a function which will return the name of the shared directory for a given app group.
from react-native-share-extension.
@benjie, can you please explain more on how you got this to work? I am trying to share data from the main app the the share extension with react-native-keychain
and I keep getting false
when calling the getGenericPassword
on the share extension...
from react-native-share-extension.
Sorry, that’s all I remember. I do remember expecting some things to be the same but they turned out to differ and that was the issue ultimately (though I don’t remember which thing that was); I suggest you look at each of the values I have mentioned in the compiled app and see where the disparity lies. Good luck!
from react-native-share-extension.
Related Issues (20)
- Issue HOT 5
- Sharing from browser: real iOS device receives page title, simulators receive URL HOT 2
- Video File Issue? HOT 1
- Audio and Video share empty value problem HOT 5
- not able to share image from google photos when app in background HOT 1
- Share extension opens up different instance of application HOT 4
- This no longer works HOT 10
- Error after clicking on my app icon during sharing (Expokit, Android) HOT 1
- 0.62.2 (Podspec) HOT 1
- 0.62.2 issue HOT 2
- 🔥How to clear image from bundle when app goes in background after receiving image prop HOT 1
- Working in React Native 0.62.2 (iOS) HOT 18
- What file extensions are allowed? HOT 1
- ERROR: File not found #import "React/RCTBridgeModule.h" HOT 1
- Cannot find lDoubleConversion HOT 1
- share ActionExtension not working with firebase
- expo-dev-client / EAS build integration? HOT 1
- Not getting Url when sharing image from Google to share extension ( Android)
- Cant share screenshot on ios
- Invariant Violation: "passages" has not been registered. This can happen if:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-share-extension.