In Android how to show a popup when post share is complete - android

I have ShareActionProvider in my Application. it shares a photo I uploaded with a text I insert. When share is done, I want to show a popup message/dialog with a button OK, clicking on which I should return to my application. The question is: in my application how can I know if share is complete or no ? For example, if I share the photo and text in instagram, how can I know that post is already done.

in my application how can I know if share is complete or no ? For example, if I share the photo and text in instagram, how can I know that post is already done.
That is not possible for ACTION_SEND. What the user does with the shared content in the other app is between the user and the developers of the other app. The user might do something immediately, later, or never. The app might do something immediately or later (e.g., upload the content as part of a periodic sync operation with a server). There is no protocol for the receiving app to tell you that sharing is "done".
Specific apps may offer specific APIs, beyond ACTION_SEND, that offer capabilities in this area, but those will be unique to those apps.

Use a Toast like this: Toast.make(context "Uploaded", Toast.LENGTH_SHORT).show();
Toast is just tiny little "popup"

Related

How to save a social media post as image programmatically to the gallery

I want to create a feature in my app that will allow the user to save a social media post to the gallery. the idea is when the user presses share on the post, my app will appear in the share dialog, and by choosing the app, the image/gif/video will be automatically saved in the gallery. but the data that I receive from the intent is of type text/plain, naturally since the share feature provides a link to the post. however on 9gag and reddit for example, on the share dialog there's a "Save to Gallery" option that does save the post as a media file to the gallery. So my question is, is it possible to program a similar function in my app? what exactly do I need to do to achieve such a functionality? I am not asking for a code, just directions, where to look for an answer since i couldn't find anything on google about my topic.
Thanks in advance !
You need to look at intent filters https://developer.android.com/training/sharing/receive
The idea with these is you declare in your manifest the type of content your app can handle. Then, when a user shares a particular type of data, such as an image, from another app, then your app can be listed as an option to handle that image.

whatsapp hyperlink - combine whatsapp://send? with intent://send/

It's possible to have a button in my web page, for sending pre-filled messages to specific number?
i'm trying with
intent://send/+391234567890#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end;whatsapp://send?text=
nothing result.
have a solution? Thanks
Firstly, write the country code without +
Message me in WhatsApp
Sadly this does not work unless the number is already in your contacts list! Making it useless.
Here's what happens for me: I get a modal dialog saying the user is not on WhatsApp and I can either Invite or SMS. This is a mistake - they're DEFINITELY on WhatsApp, but not in my contacts because I've deleted them for testing.
Workaround idea
Offer vCard to save to Contacts
Since the phone number has to be in the Contacts list first, let's get it there. Track the site visitor to see if it's the first time she tapped on Contact me on WhatsApp (a cookie?). If it's the first time she tapped, make the link download your vCard
href="johnsmith.vcf"
The user now has to open the downloaded vCard with the People app, and add you to her Contacts.
Android intents URI FTW
When she returns, assuming she added you, make the button work with the intent:// URI scheme.
href="intent://send/391234567890#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end"
She taps on it and is magically transported to a WhatsApp chat with you.
Keep track of which href to present
Hopefully you can use the cookie you set to track her so you don't have the button offer the vCard AGAIN. There's no other way to know if your number is in her Contacts list unless you ask. But then it's not a button anymore, it's a form.
Same goes for Telegram. Security implications are probably the ones keeping Instant Messaging not so instant.

Get share content through accessibility in android app

I have an android app, which lets people share content from other apps to it. When it receives the shared data, it looks for the URL in the shared text and fetches the page and does processing on the data fetched. This is designed with specific purpose and not a generic for all apps.
It works fine, except that people have to click the share icon and then choose our app name. With accessibility we can reduce this work for the users. We are able to get the text displayed in the app.
Is it possible to get the content which we would get if we were to click the share button.
Or
Is it possible to trigger the share button and choose our app without disturbing the user in anyway
You could try that if it's only for 1 specific app. See question How to click button in settings using AccessibilityService? which clicks a button. This will not scale if you want to do this for more apps. You could however parse the text that is on the screen and look for http links and process them in a background service and then show a floating button like Link Bubble Browser
You can simply trigger the share activity of your app when you detect the text from the other app; but the question is how will you know when user is done typing the text?!
One way is you can place a system-wide floating button similar to Facebook Messenger and after user clicks it, the text can be shared. This will reduce number of clicks user has to do.
So,
1) Yes, its possible to get text content via AccessibilityService.
2) No, you cannot automate this action.

Send image to another application

I want to know if that is a way in the moment i take a picture, send it in background to other app, like a vault, keepsafe or appprotector?
Without the user has to go to gallery and click in share with others apps above . I would like that was automatic, without use "app chooser".
You would need to ask the authors of your proposed "vault, keepsafe or approtector" if they support some custom API for this. There are no conventions in Android for sending content to another app in the background. In the foreground, you are welcome to use ACTION_SEND, or ShareActionProvider, etc.

Is it possible to put a Facebook like button in a mobile app and when used, it would like my website url?

I have an Android and an iPhone mobile app into which I need to put a Facebook like button for marketing purposes.
The problem is that I am not sure what is really being liked when a user likes something from inside a mobile app. I have a website for the two apps (Android and iPhone) so it seems that this website should be liked when a user likes something from a mobile app.
Is that possible to do?
From my experience and what i know, Facebook doesn't leave you the possibility to use a likeButton into a mobil Application, they don't want the users to be spammed by those in every apps.
From my point of view, there is two solutions, but neither are perfect :
You use Facebook OpenGraph and create a like action for a Website Object, you can find more informations about Facebook OpenGraph on facebook documentation, OpenGraph web tutorial and the last one examples that are more specific to iOS. But if i remember right, you won't be able to create an action called "Like", i think facebook will prevent it so there is no confusion for the users, but as i'm not sure at all, it's still worth a try.
the second solution is to make a simple UIButton, and when you click on it you just show a webview of the facebook page you want the user to like. If you want to know if the user liked your page, you can always make a request for his likes and try to find your facebook page id in it, whenever the user did exit the webview.
I hope i answered your question.
And if ever you find a way to make a real facebook like (not an opengraph), directly in a native mobile application, i would be very interested in knowing the howto.
EDIT:
Actually, only the second solution would work if it's to like a facebook fanpage, as for OpenGraph you need to be able to modify the metadata sent by the page so it fits the properties of your object.
The Opengraph solution would work only to make a fake "like" on a webpage of your own.
Use this code. You should be logged in to Facebook, before using this code. Check whether the Facebook session is valid and then use this code.
WebView foll_fb = (WebView) findViewById(R.id.btn_foll_fb);
String url = "http://www.facebook.com/plugins/like.php?layout=standard&show_faces=true&width=80&height=50&action=like&colorscheme=light&href=YOUR_URL_TO_LIKE";
foll_fb.loadUrl(url);
foll_fb.getSettings().setJavaScriptEnabled(true);
foll_fb.requestFocus(View.FOCUS_DOWN);
foll_fb.setWebViewClient(new LikeWebviewClient());
Correct. If you click a like button inside a mobile app, most users expect that they have liked the corresponding page. If you have a page for both the android and the iOS app, then it should like the corresponding one.
In case you wanted to know how to do this, I can give you the main idea. Simply place a button, that on tap, runs whatever is necessary to like something. Since I personally haven't done that, I'm not sure what needs to be run.
Hope that helps, but someone else probably has a better answer than I do. Meaning the actual code to that.

Categories

Resources