com.google.android.gms.plus.PlusShare Java Examples
The following examples show how to use
com.google.android.gms.plus.PlusShare.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoCastControllerActivity.java From android with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); } if (item.getItemId() == R.id.action_share) { Intent shareIntent = new PlusShare.Builder(this) .setType("text/plain") .setText(getString(R.string.share_intent_text)) .setContentUrl(Uri.parse("https://plus.google.com/u/4/communities/116034521997245237036")) .getIntent(); startActivityForResult(shareIntent, 0); } return true; }
Example #2
Source File: SoomlaGooglePlus.java From android-profile with Apache License 2.0 | 6 votes |
private void uploadImage(String message, String filePath) { try{ File tmpFile = new File(filePath); final String photoContentUri = MediaStore.Images.Media.insertImage( getContentResolver(), tmpFile.getAbsolutePath(), null, null); Uri uri = Uri.parse(photoContentUri); String mime = getContentResolver().getType(uri); Intent shareIntent = new PlusShare.Builder(this) .setText(message) .setStream(uri) .setType(mime) .getIntent(); startActivityForResult(shareIntent, REQ_SHARE); }catch (Exception e){ RefSocialActionListener.fail("Failed uploading image with exception: " + e.getMessage()); } }
Example #3
Source File: ParseDeepLinkActivity.java From io2014-codelabs with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String deepLinkId = PlusShare.getDeepLinkId(this.getIntent()); int scoreToBeat = 0; try { scoreToBeat = Integer.parseInt(deepLinkId.substring(1)); } catch (NumberFormatException e) { // Bad parse for some reason. Beware of using raw // input from the web. Log.e("ParseDeepLinkActivity", "Bad parse of " + deepLinkId); } // Set the challenge score // Now start the activity with Intent newIntent = new Intent(this, SquashActivity.class); startActivity(newIntent); finish(); }
Example #4
Source File: ParseDeepLinkActivity.java From io2014-codelabs with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String deepLinkId = PlusShare.getDeepLinkId(this.getIntent()); int scoreToBeat = 0; try { scoreToBeat = Integer.parseInt(deepLinkId.substring(1)); } catch (NumberFormatException e) { // Bad parse for some reason. Beware of using raw // input from the web. Log.e("ParseDeepLinkActivity", "Bad parse of " + deepLinkId); } // Set the challenge score // Now start the activity with Intent newIntent = new Intent(this, SquashActivity.class); startActivity(newIntent); finish(); }
Example #5
Source File: NavigationDrawerFragment.java From IdealMedia with Apache License 2.0 | 5 votes |
private void shareGplus() { Intent shareIntent = new PlusShare.Builder(getActivity()) .setType("text/plain") .setText(getString(R.string.like_text)) .setContentUrl(Uri.parse(getString(R.string.like_url))) .getIntent(); startActivityForResult(shareIntent, 0); showThankYouToast(); ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER) .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("Gplus").setLabel("OK").build()); }
Example #6
Source File: SoomlaGooglePlus.java From android-profile with Apache License 2.0 | 5 votes |
private void updateStatus(String status) { Intent shareIntent = new PlusShare.Builder(this) .setType("text/plain") .setText(status) .getIntent(); startActivityForResult(shareIntent, REQ_SHARE); }
Example #7
Source File: SoomlaGooglePlus.java From android-profile with Apache License 2.0 | 5 votes |
private void updateStatusDialog(String link) { Intent shareIntent = new PlusShare.Builder(this) .setType("text/plain") .setContentUrl(Uri.parse(link)) .getIntent(); startActivityForResult(shareIntent, REQ_SHARE); }
Example #8
Source File: SoomlaGooglePlus.java From android-profile with Apache License 2.0 | 5 votes |
private void updateStory(String message, String name, String caption, String description, String link, String picture) { try{ //TODO: https://developers.google.com/+/mobile/android/share/interactive-post ? Intent shareIntent = new PlusShare.Builder(this) .setType("text/plain") .setText(message) .setContentUrl(Uri.parse(link)) .getIntent(); startActivityForResult(shareIntent, REQ_SHARE); }catch (Exception e){ RefSocialActionListener.fail("Failed sharing story with exception: " + e.getMessage()); } }
Example #9
Source File: MainActivity.java From gplus-haiku-client-android with Apache License 2.0 | 5 votes |
@Override public void onPromoteCall(Haiku haiku) { Intent share = new PlusShare.Builder(this) .setType("text/plain") .setContentUrl(Uri.parse(haiku.contentUrl)) .setContentDeepLinkId(haiku.contentDeepLinkId) .addCallToAction( getString(R.string.vote_cta), Uri.parse(haiku.callToActionUrl), haiku.callToActionDeepLinkId ) .getIntent(); startActivityForResult(share, REQ_SHARE); }
Example #10
Source File: MainActivity.java From gplus-haiku-client-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); mDialog = new ProgressDialog(this); SignInButton signIn = (SignInButton) findViewById(R.id.button_sign_in); signIn.setOnClickListener(this); signIn.setSize(SignInButton.SIZE_WIDE); findViewById(R.id.button_sign_out).setOnClickListener(this); findViewById(R.id.button_disconnect).setOnClickListener(this); mHaikuPlusSession = HaikuSession.getSessionForServer(getApplicationContext()); mHaikuApi = HaikuClient.getInstance(this, mHaikuPlusSession); mVolley = VolleyContainer.getInstance(this); // Check the constants if (Constants.SERVER_CLIENT_ID.equals("YOUR_WEB_CLIENT_ID") || Constants.SERVER_URL.equals("YOUR_PUBLIC_SERVER_URL")) { throw new RuntimeException("Error: please configure SERVER_CLIENT_ID and " + "SERVER_URL in Constants.java"); } GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this) .addOnConnectionFailedListener(this) .addConnectionCallbacks(this) .setAccountName(mHaikuPlusSession.getAccountName()) .requestServerAuthCode(Constants.SERVER_CLIENT_ID, this); // Add scopes for (String scope : Constants.SCOPES) { builder.addScope(new Scope(scope)); } // Add Google+ API with visible actions Plus.PlusOptions plusOptions = new Plus.PlusOptions.Builder() .addActivityTypes(Constants.ACTIONS) .build(); builder.addApi(Plus.API, plusOptions); mGoogleApiClient = builder.build(); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new StreamFragment(), STREAM_FRAG_TAG) .commit(); } String deepLinkId = PlusShare.getDeepLinkId(this.getIntent()); if (deepLinkId != null) { mDeepLink = HaikuDeepLink.fromString(deepLinkId); if (mDeepLink.getHaikuId() == null) { // If the ID is bad, just ignore the deeplink. mDeepLink = null; Log.d(TAG, "Got bad deeplink: " + deepLinkId); } else { showDialog(getString(R.string.loading_haiku)); mHaikuApi.fetchHaiku(mDeepLink.getHaikuId(), this); } } // Hide sign in button and load user if we have cached account name and session id if (mHaikuPlusSession.checkSessionState() == HaikuSession.State.HAS_SESSION) { setProgressBarIndeterminateVisibility(true); findViewById(R.id.signed_out_container).setVisibility(View.GONE); mHaikuApi.fetchCurrentUser(this); } }