Some how creating a share history file fixes this issue
this can be fixed by using a custom share history file on app install.
e.g. call CreateShareHisotryFile() on App Create()
public class YourBrokenAPP extends Application {
public static SHARE_HISTORY_FILE_NAME = "c_share_hist.xml";
@Override
public void onCreate() {
super.onCreate();
CreateShareHisotryFile();
}
private void CreateShareHisotryFile() {
String data = "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?> "+
"<historical-records>" +
"<historical-record activity=\"com.google.android.apps.plus/com.google.android.libraries.social.gateway.GatewayActivity\" time=\"1426500217970\" weight=\"1.0\" />"+
"</historical-records>";
try {
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(openFileOutput(SHARE_HISTORY_FILE_NAME, Context.MODE_PRIVATE));
outputStreamWriter.write(data);
outputStreamWriter.close();
}
catch (IOException e) {
Log.e("Exception", "File write failed: " + e.toString());
}
}
then in the fragment's onCreateOptionsMenu use share history file we just created ....
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.main, menu);
// Set up ShareActionProvider's default share intent
MenuItem shareItem = menu.findItem(R.id.action_share);
mShareActionProvider = (ShareActionProvider)
MenuItemCompat.getActionProvider(shareItem);
mShareActionProvider.setShareHistoryFileName(c_share_hist.xml);
}
Note that historical-records needs @ least one historical-record child element in the xml file
then it's all good
ENJOY.......