mercredi 25 février 2015

ShareActionProvider sharing issues

I have a couple of issues sharing website URL wrapped in my android app. The below is my code snippet. As you can say. I share text/plain type with subject and text. The issues are: 1. In my samsung galaxy Pro-rugby (OS 4.1.2) when I touched the dropdown sharing options(email, facebook, ...) nothing happened, but it works for samsung galaxy S5 (4.4.2). To make those sharing media pop up on my Pro-rugby I have to add a line SiteActivity.this.startActivity(intent) inside onShareTargetSelected, but galaxy s5 doesn't need it otherwise sharing screen will pop-up twice. I did search couldn't find from which version of os started to function like galaxy s5.




  1. Sharing via facebook the link facebook got from mobile site are URL encoded. It happens there is a parameter in url like N:1554 in which colon (:) symbol was encoded as "%3A". When the link was clicked the parameter in browser addresses shown as N%3A1554 and broken. This only happened in facebook.




  2. Facebook, google+ and twitter don't take the subject and text I set. It seems they use their own content they get from my mobile site. Is there any way to make those media to use the subject and text I set?




Thank you in advance.


@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.site, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.action_share);



// Fetch and store ShareActionProvider
shareActionProvider = (ShareActionProvider) item.getActionProvider();
setShareIntent();
shareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) {

// SiteActivity.this.startActivity(intent);

return true;
}
});
return true;
}

// Call to update the share intent
private void setShareIntent()
{
if (shareActionProvider != null) {
shareURL();
shareActionProvider.setShareIntent(sharedIntent);
}
}

private Intent shareURL()
{
if(sharedIntent ==null) {
sharedIntent = new Intent(Intent.ACTION_SEND);
sharedIntent.setType("text/plain");
sharedIntent.putExtra(Intent.EXTRA_SUBJECT, "Shop at Nebraska Furniture Mart");
}
sharedIntent.putExtra(Intent.EXTRA_TEXT, wv.getUrl());
return sharedIntent;
}

Aucun commentaire:

Enregistrer un commentaire