how to complete Facebook,LinkedIn,and Twitter social networks on Android systems
10 minute(s) read | Published on: Aug 13, 2021 Updated on: Dec 14, 2021 |
Android systems give this possibility and permission to their users to access social networks by connecting to the Internet using the networks of the Android system and performing their desired activities there. In this way, users can access social networks such as Facebook, LinkedIn, Twitter, and other networks through Android systems, where they can share data and use the shared data.
Learn how to complete Facebook, LinkedIn, and Twitter social networks on Android systems
In this part of the article, we want to talk about accessing and using social networks such as Facebook and LinkedIn. If you want to know about them, it is recommended that you follow this article.
How to complete Facebook on Android systems
It should be noted that there are two ways to do this:
- Facebook SDK
- Intent Share
Total Facebook using the Facebook SDK method
This method is the first way to connect to Facebook, which requires us to first register our application and get a few Applications id. Then we must download the Facebook SDK and add it to our project.
In this section, we must make sure that we have installed SSL or not. If SSL is not installed, we must install it and generate the main attribute.
1- In this case, we must open the command bar and select the java jre folder.
2- By typing the following command in the command bar, we can easily access that folder.
3- After entering the above command in the command bar, you will be transferred to the password field.
4- You must choose the word Android as your password.
5- Then, we must copy the key that it gives us and keep it on the clipboard.
6- Now it's time to enter a Facebook application in developers.facebook.com/apps.
7- After that, we enter the internal Android application and enter the necessary information about the project name and the group's name there, and I also paste the text copied in the clipboard here.
8- After completing all the steps listed above, you will receive an ID, which is recommended to copy and save on the clipboard.
9- Download the Facebook SDK and insert it into eclipse.
10- After that, click on your Facebook project and select add.
11- Then select the Facebook SDK as the project and click OK.
12- To enter the program, you must call the openActiveSession method and run the callback. Like the following:
13- It should be noted that Intent sharing is used to share data between applications.
14- Android system also provides an Intent library, and to be able to use it as share intent, we must specify the type of share intent for ACTION_SEND. Like the following:
15- Then, we need to define a data type for transmission. Like the following:
16- It should be noted that this is not the only method, and in addition to this method, other methods can be used to address intent. Those methods are listed below:
- AddCategory method: This method adds a new component to intent.
- CreateChooser method (Intent target): This method is the same convenient function for creating ACTION_CHOOSER Intent.
- GetAction () method:
GetAction () method is used to retrieve general activity such as ACTION_VIEW.
- GetCategories () method: This method is used to return the intent.nt component set.
- PutExtra method (String name): This method can add large data to intent.
- toString () method: This method is also used to convert a string containing a clear explanation.
In this part of the tutorial, we will give you an example to better understand and easily understand the content using that example.
1- I use Eclipse IDE to create an Android application.
2- Name it IntentShare in the com. example package. We name intentShare.
3- Modify the src / MainActivity.java file to add a different code.
4- The res /layout / activity_main file must be modified to add the XML component.
5- Change AndroidManifest.xml to get permissions.
6- All contents and codes that are completely included in the file and program are as follows:
7- The modified content of the res/layout / activity_main.xml file is as follows, and you can see it:
8- The codes and contents inside the res/values / string.xml file are as follows:
9- The following code is the contents of the AndroidManifest.xml file:
10- Run the IntentShare program.
11- You must connect your mobile device to the computer beforehand.
12- In order to be able to run the program from Eclipse, we must open one of the program activities files, and we will be faced with a window that it is better to select our mobile device.
13- Then select Facebook and start writing the message.
14- After writing the message, by selecting the post option, the written message will be posted on Facebook.
How to total LinkedIn
It should be noted that there are two ways to complete LinkedIn in Android systems:
- Linkedin SDK (Scribe)
- Intent Share
Linkedin SDK
This method is the first way to connect to LinkedIn, requiring us to register our application and receive several application ids. Then we must download the Linkedin SDK and add it to our project.
1- Create a new Linkdin program at dev.linkedin.com/apps/new.
2- Then click on a new application.
3- Then, we fill in the requested information section.
4- If you follow the above steps carefully and correctly, you will finally receive an API key with a password.
5- Copying the API key and saving it in the clipboard is recommended.
6- Download Linkdin.
7- Copy scribe-1.3.0.jar jar into the project libs folder.
8- It should be noted that Intent sharing is used to share data between applications.
9- Android system also provides an Intent library, and to be able to use it as share intent, we must specify the type of share intent for ACTION_SEND. Like the following:
10- Then, we define the type of data transfer. Like the following:
11- Of course, it should be noted that there are other methods that can allow intent control in addition to these methods.
- AddCategory method: This method can add a new row to intent.
- CreateChooser method (Intent target): This method is an easy operation to create ACTION_CHOOSER Intent.
- GetAction () method:
GetAction () method is used to retrieve general activity such as ACTION_VIEW.
- GetCategories () method reports all intent.nt rows.
- PutExtra method: This method is also used to add extensive data to intent.
- toString () method: This method also provides a string that contains a clear explanation.
Example of creating a LinkedIn application
1- I use Eclipse IDE to create an Android application.
2- Name it IntentShare in the com.example.intentshare package.
3- Modify the src / MainActivity.java file to add a different code.
4- The res/ layout / activity_main file must be modified to add the XML component.
5- Change AndroidManifest.xml to get permissions.
6- All contents and codes that are completely included in the file and program are as follows:
7- Contents of res/ layout / activity_main.xml file:
8- The contents of the res/values / string.xml file:
9- Contents of AndroidManifest.xml file:
10- Run the IntentShare program.
11- You must connect your mobile device to the computer beforehand.
12- To be able to run the program from Eclipse, we must open one of the program activity files and click on Run.
13- Then, we are faced with a window that it is better to choose our mobile device.
14- Select Linkedin.
15- Write a message.
16- Click the post button.
17- After that, your article will be posted on Linkedin.
Twitter completion tutorial
It should be noted that there are two ways to complete LinkedIn in Android systems:
- Twitter SDK (Twitter4J)
- Intent Share
Twitter SDK
This method is the first way to connect to LinkedIn, which requires us to first register our application and receive several application ids. Then we must download the Twitter SDK and add it to our project.
1- We will create a new twitter application at dev.twitter.com/apps/new.
2- Then click on the new application.
3- Then, we fill in the requested information section.
4- Then, in the settings section, we must change the access to Read, Write, and access direct messages.
5- If you follow the above steps carefully and correctly, you will finally receive an API key with a password.
6- It is recommended to copy the API key and save it in the clipboard.
7- Download the Twitter SDK.
8- Copy the twitter4J jar inside the project lib folder.
9- To be able to use Twitter, we must create an object from the Twitter group and call it using the getsingleton () method. Like the following:
10- Call the updateStatus () method to update the status. Like the following:
11- It should be noted that Intent sharing is used to share data between applications.
12- Android system also provides Intent library, and to be able to use it as share intent, we must specify the type of share intent for ACTION_SEND. Like the following:
13- Then, we define the data type for data transfer:
14- Other methods that can be used to handle intent are as follows:
- AddCategory method: Adds a new section to intent.
- CreateChooser method: A simple operation to create ACTION_CHOOSER Intent.
- getAction () method: This method returns comprehensive activity such as ACTION_VIEW.
- GetCategories () method: This method also reports a set of intent.nt components.
- PutExtra method adds extended data to intent.
- toString (): reports a string of complete and clear descriptions.
Example of creating a Twitter app
1- We use Eclipse IDE to create an Android application.
2- Name it IntentShare in the com.example.intentshare package.
3- Modify the src / MainActivity.java file to add a different code.
4- The res/layout / activity_main file must be modified to add the XML component.
5- Change AndroidManifest.xml to get permissions.
6- All contents and codes that are completely included in the file and program are as follows:
7- Content of res / layout/ activity_main.xml file:
8- File content res / values / string.xml:
9- Content of AndroidManifest.xml file:
10- Run the IntentShare program.
11- You must connect your mobile device to the computer beforehand.
12- To be able to run the program from Eclipse, we must open one of the program activity files and click on Run.
13- Then, we are faced with a window that it is better to choose our mobile device.
14- Then select twitter and start writing the message.
15- After writing the message, by selecting the post option, the written message will be posted on Facebook.
About our Android and iOS app development services