-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android tweet share uses the webbrowser in the emulator (Not an error, Explanation inside) #44
Comments
Hi @pakicoder123 I didn't code the Android part myself, but looking through the files it seems to me that it is just a fallback in case there is no Twitter app installed, so yes it is because you are in the emulator. if (doesPackageExist("com.twitter.android")) {
try {
tweetViaTwitterComposerClass(shareText);
} catch (Exception ex1) {
try {
tweetViaTwitterDefaultClass(shareText);
} catch (Exception ex2) {
tweetViaWebPopup(shareText);
}
}
} else {
tweetViaWebPopup(shareText);
} private void tweetViaWebPopup(String shareText) throws Exception {
String tweetUrl = "https://twitter.com/intent/tweet?text=" + shareText;
Uri uri = Uri.parse(tweetUrl);
Intent shareIntent = new Intent(Intent.ACTION_VIEW, uri);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
reactContext.startActivity(shareIntent);
} |
Hi, thank you for the quick reply! |
@pakicoder123 - definitely agreed. If you get it working to the point of the browser opening you're all set, once it's on a device with the Twitter app it works. |
I should probably clarify, I mean is there any way to stay in the app and post a status with an image, without needing the twitter app downloaded as well? |
You are welcome @pakicoder123 Hey @angusmccloud
Maybe we should add that as a side note in the README to new people coding for Android. What do you think? |
@doefler So basically I want a user to be able to click a share button and have my app post a tweet with an image I pull from our backend, saying something like "hey everyone, check this out!". But I want it all to be done in-app, with no need for installation of other apps and without the user ever leaving my app. Your library is great but with the caveat that the user will need to either install the twitter app or be temporarily taken into their chrome browser. That's why I was thinking maybe a workaround to this roadblock would be to use a twitter api post request, but I've scoured the webs and the only thing I found was "react-native-twitter", which is capable of posting a status with an image: the only problem is that the image needs to be pulled from the device's camera roll, apparently that's a special type of image object in react native. Please let me know if you could offer any insight into this problem |
I have no experience coding for Android so can't really give any educated advice. My initial thoughts:
|
Thank you for all your advice, will definitely read up more on that link and try out your suggestions. My sincere appreciation for your talented coding, time, and help. |
You are welcome, let's keep it open in case other people are wondering about the web popup. |
Sounds fine by me, I'm new to github issues too lol. Hope other people find what they're looking for too, have a good day |
Same here 😄 |
Hi there,
Firstly I'd like to say that I really like the library you guys have built. The main problem I'm having is that when I click "share on twitter", it opens up the chrome browser on my emulator and sets up the tweet over there. On the README, you guys have it showing a popup within the app where you can send the tweet. Is this just because I'm on an Android emulator, or am I missing something? Please help. Thank you.
The text was updated successfully, but these errors were encountered: