Getting started
=====================
**Adding library**
_1) Using Maven Central_
Add dependency for chosen module, here example for all modules, you can choose one or two
```
dependencies {
...
compile 'com.github.asne:asne-facebook:0.3.3'
compile 'com.github.asne:asne-twitter:0.3.3'
compile 'com.github.asne:asne-googleplus:0.3.3'
compile 'com.github.asne:asne-linkedin:0.3.3'
compile 'com.github.asne:asne-instagram:0.3.3'
compile 'com.github.asne:asne-vk:0.3.3'
compile 'com.github.asne:asne-odnoklassniki:0.3.3'
...
}
```
_2) Import module to your project_
For example, in AndroidStudio you can add modules via Gradle:
1. Copy social module to your project.
2. In settings.gradle include `':ASNECore', ':socialNetworkModuleName'`
3. In build.gradle of your app (YOUR_PROJECT/app/build.gradle) add new dependencies: `compile project(':socialNetworkModuleName') `
Without Gradle, add ASNE like:
1. Open Project Settings and choose Modules.
2. Find button "Add" (+), and choose Import module
3. Find ASNECore and socialNetworkModuleName directories - «Add».
4. Choose Create module from existing sources, then click "Next" rename module from "main" to "ASNECore".
5. Add new asne-module in dependencies to your app.
**Using library**
Firstly, you need to create app in social network. You can read about main steps:
- [Twitter](https://github.com/gorbin/ASNE/wiki/Create-Twitter-App)
- [LinkedIn](https://github.com/gorbin/ASNE/wiki/Create-LinkedIn-App)
- [Facebook](https://github.com/gorbin/ASNE/wiki/Create-Facebook-App)
- [Google Plus](https://github.com/gorbin/ASNE/wiki/Create-Google-Plus-app)
- [Instagram](https://github.com/gorbin/ASNE/wiki/Create-Instagram-App)
- [Vkontakte](https://github.com/gorbin/ASNE/wiki/Create-Vkontakte-App)
- [Odnoklassniki](https://github.com/gorbin/ASNE/wiki/Create-Odnoklassniki-App)
Second, we need to catch response after login via social network login dialog:
```java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Fragment fragment = getSupportFragmentManager().findFragmentByTag(BaseDemoFragment.SOCIAL_NETWORK_TAG);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}
}
```
Then, you need to initialize `mSocialNetworkManager`, it contain common interface for all ASNE social network modules. Initialize chosen social network and add social network to SocialNetworkManager(example: FacebookSocialNetwork):
```java
mSocialNetworkManager = (SocialNetworkManager) getFragmentManager().findFragmentByTag(SOCIAL_NETWORK_TAG);
if (mSocialNetworkManager == null) {
mSocialNetworkManager = new SocialNetworkManager();
FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(this, fbScope);
//or from an activity
//FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(mSocialNetworkManager, this, fbScope);
mSocialNetworkManager.addSocialNetwork(fbNetwork);
getFragmentManager().beginTransaction().add(mSocialNetworkManager, SOCIAL_NETWORK_TAG).commit();
}
```
where `fbScope` is **permissions** for your app, for example I used:
```java
ArrayList
License
=====================
ASNE is made available under the MIT license: [MIT license](http://opensource.org/licenses/MIT):
The MIT License (MIT) Copyright (c) 2014 Evgrny Gorbin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.[1]: https://raw.githubusercontent.com/gorbin/ASNE/master/resources/recomended.png [2]: https://github.com/gorbin/AndroidSocialNetworks [3]: https://raw.githubusercontent.com/gorbin/ASNE/master/resources/main.png [4]: https://github.com/gorbin/ASNE/releases [5]: https://github.com/gorbin/ASNE/releases/download/0.2/ASNE-debug-unaligned.apk [6]: https://www.facebook.com/evgeny.gorbin