Android Provide really great features for Developer. Android developer have made very easy to share your application on different social sites using Intent.ACTION_SEND.This action allow to share any information you want to share like your application used by user(Flip board) or images to share with friends using any app (whats app, facebook).
Social sharing is great and required feature in Android Application. using it user can share info about your application. Intent.ACTION_SEND allows to share data using different mediums like Message , facebook ,whats app etc.
Well it is easy to implement it into your project. in this tutorial i am gone show you how you can add this feature in your app (not from crating application).
Above code will fetch all apps that can share content. in your emulator it won't display any options but in actual device it will display all apps in popup menu.
As You can see It shows Share Logo as well as recent used application to share also display in action bar. Note that you have to write code for information you want to share like what to share on facebook or on Twitter etc.
Social sharing is great and required feature in Android Application. using it user can share info about your application. Intent.ACTION_SEND allows to share data using different mediums like Message , facebook ,whats app etc.
Well it is easy to implement it into your project. in this tutorial i am gone show you how you can add this feature in your app (not from crating application).
- First Create New Application.(Hope you know it).
- Now go to your Menu.xml file and paste below code.
- Now Open you main activity or where you want to give share option to the user. and Paste below code in onCreateOptionMenu() method.
MenuItem item = menu.findItem(R.id.menu_item_share); mShareAction = (ShareActionProvider) item.getActionProvider(); // Create the share Intent String playStoreLink = "https://play.google.com/store/apps/details?id=" + getPackageName(); String yourShareText = "Install this app " + playStoreLink; Intent shareIntent = ShareCompat.IntentBuilder.from(this) .setType("text/plain").setText(yourShareText).getIntent(); // Set the share Intent mShareAction.setShareIntent(shareIntent);
Above code will fetch all apps that can share content. in your emulator it won't display any options but in actual device it will display all apps in popup menu.
As You can see It shows Share Logo as well as recent used application to share also display in action bar. Note that you have to write code for information you want to share like what to share on facebook or on Twitter etc.
0 comments :
Post a Comment