Gplus intent sharing on Android 4.4.2 - android

I am using the below mention code to share on GPLUS. It is sharing successfully on emulator and on several other devices.
Intent shareIntent = new PlusShare.Builder(ActivityDetail.this)
.setType("text/plain")
.setText(
offer.title + " - "
+ J.Funcs.decode(offer.description_detailed))
.setContentUrl(Uri.parse(offer.image)).getIntent();
startActivityForResult(shareIntent, 1);
But the problem is, it is crashing on sharing. Any idea what I have done wrong?

Related

Android firebase dynamic link opens browser before launching the app

I've been using firebase dynamic links for my app and recently encountered the issue where when clicking on the link, instead of opening a choice view for what to use to open the app (where I can just choose my app) it's instead launching the browser first for a split second, then there's a small loading screen and then the app is launched.
This results a very unpleasant jitter that didn't happen before and I'm not sure what might suddenly cause this (I haven't changed the code). The only changes from before this issue and after is updating my phone to android version 12, and updating the gradle to use compileSdkVersion and targetSdkVersion 30.
Just in case, the code where I build the link for sending:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND)
.setType("text/plain")
.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Construct dynamic link
String link = ParametersConventions.PREFIX
+ "&"
+ ParametersConventions.PARAMETER
+ "="
+ DATA
+ ParametersConventions.POSTFIX;
DynamicLink.Builder builder = FirebaseDynamicLinks.getInstance().createDynamicLink();
builder.setLink(Uri.parse(link));
builder.setAndroidParameters(new DynamicLink.AndroidParameters.Builder("com.my.package").build());
builder.setDomainUriPrefix(ParametersConventions.DOMAIN_PREFIX);
DynamicLink.SocialMetaTagParameters.Builder metaTagsBuilder = new DynamicLink.SocialMetaTagParameters.Builder();
metaTagsBuilder.setTitle("title");
metaTagsBuilder.setDescription("descp");
builder.buildShortDynamicLink().addOnSuccessListener(shortDynamicLink -> {
sendIntent.putExtra(Intent.EXTRA_TEXT, shortDynamicLink.getShortLink().toString());
Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivity(shareIntent);
}).addOnFailureListener(e -> {
});
If anyone encountered it \ has an idea how I might fix it I would greatly appreciate the help. Could this be related to the fact the app isn't yet on Google appstore?

Android Share Intent Facebook post wrong Thumbnails

Currently i am working on an app where there is an option to share text from the app to different Social network like Google, Instagram,Facebook etc. All are working fine except facebook where it picks up wrong random thumbnails. The code for sharing is like below:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
if (Preferences.getBoolean(getString(R.string.pref_copyWithShareUrl_key), getResources().getBoolean(R.bool.pref_copyWithShareUrl_default)))
{
shareIntent.putExtra(Intent.EXTRA_TEXT, verse.getText() + "\n\n" + "http://play.google.com/store/apps/details?id=" + getPackageName());
//shareIntent.putExtra(Intent.EXTRA_TEXT, verse.getText() + "\n\n" + " https://market.android.com/search?q=pname:" + getPackageName());
}
else
{
shareIntent.putExtra(Intent.EXTRA_TEXT, verse.getText());
}
Currently the sharing look like this:
But what i want is to include my app launchers image icon to be shared only. How can i achieve that without affecting the other share option.
Thanks
Use ShareLinkContent provided by facebook to share

Attach image to the Messages app programatically

I'm develop an app use mms message of android.
Currently I can:
Send ssm message but not attached image by use following code:
Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("sms_body", message);
smsIntent.setData(Uri.parse("sms:" + phoneNumber));
((Activity) context).startActivityForResult(smsIntent, 0);
Send attach image via third party app:
Intent mmsIntent = new Intent(Intent.ACTION_SEND);
mmsIntent.putExtra("sms_body", "Please see the attached image");
mmsIntent.putExtra(Intent.EXTRA_STREAM, attached_Uri);
LogUtils.debug(TAG, "extension: " + extension);
mmsIntent.setType(extension);
((Activity) context).startActivityForResult(mmsIntent, 0);
My problems:
Can't attach image to default messaging app of android.
How can i detect if default messaging app of android device ( such as tablet ) not exist.
So, please guild me on this problem.
Thanks you so much.
Solution for 1st problem
Intent mmsIntent = new Intent(Intent.ACTION_SEND);
mmsIntent.putExtra("sms_body", "Please see the attached image");
mmsIntent.putExtra(Intent.EXTRA_STREAM, attached_Uri);
mmsIntent.setType("image/gif");
startActivity(Intent.createChooser(mmsIntent,"Send"));
Solution for 2nd problem
You don't have to worry about that, Playstore will.
If you are using sms feature you would have given permission. So your app will not be vissible in playstore for SMS featureless devices
EDIT:
To include the sender address add an additional EXTRA to the intent
mmsIntent.putExtra("address","number_here");

Share a picture on Google+ with Android

I can easily share a text in Google+ but when i want to add a picture with the text, i got this message ;
You can only post media items stored in your device.
Here is my code:
Uri uri = Uri.parse("android.resource://com.smurf.fapiao/" + R.drawable.myimage);
// Launch the Google+ share dialog with attribution to your app.
Intent shareIntent = new PlusShare.Builder(getActivity())
.setType("image/png").setStream(uri)
.setText(getString(R.string.social_googleplus_text) + " http://www.wangwanglotto.com")
.getIntent();
startActivityForResult(shareIntent, 0);
Do you have any idea ? I tried to put the file in raw or assets folder, but i still get the message.
Thanks in advance

How to get the current screen after sending a mail from the app in Android

final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "From my site");
intent.putExtra(Intent.EXTRA_TEXT, card.text + "\n\n"
+ "Sent from my site " + " "
+ "http://www.mysite.com");
startActivity(intent);
I did this in my application, and after sending the email my application exits, but I don't want it to. After sending the email I want it to return to the screen from my app. Can anyone help me with this?
Ideally it should not exit. In fact I tried out your code on my machine and it came back to the activity fine.
I think your application may be crashing somewhere just after this particular piece of code. Try debugging it, or maybe check your logcat for possible exceptions !

Categories

Resources