{"id":19004276,"url":"https://github.com/oneall/android-sdk","last_synced_at":"2025-04-22T18:29:32.448Z","repository":{"id":29641518,"uuid":"33182926","full_name":"oneall/android-sdk","owner":"oneall","description":"This SDK provides the tools to use OneAll on the Android platform. It allows users to login with their social network accounts and to share messages with their friends. The library is integrated with a few lines of code and uses native Android integration with Facebook and Twitter where possible.","archived":false,"fork":false,"pushed_at":"2023-07-27T10:23:54.000Z","size":770,"stargazers_count":10,"open_issues_count":3,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-17T10:23:51.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://docs.oneall.com/services/implementation-guide/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oneall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-03-31T11:59:54.000Z","updated_at":"2024-10-24T13:38:01.000Z","dependencies_parsed_at":"2022-09-03T18:41:01.228Z","dependency_job_id":"b408a2d6-032c-4650-a5bf-6fa69c3eedcf","html_url":"https://github.com/oneall/android-sdk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneall%2Fandroid-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneall%2Fandroid-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneall%2Fandroid-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneall%2Fandroid-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oneall","download_url":"https://codeload.github.com/oneall/android-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250296873,"owners_count":21407108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T18:22:31.894Z","updated_at":"2025-04-22T18:29:32.416Z","avatar_url":"https://github.com/oneall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Developing Android application with OneAll SDK\n\nOneAll SDK provides tools to use OneAll Social Login features on Android Platform. It allows logging in users and posting messages on social networks using existing OneAll connectors. The library is integrated in a few lines of code and uses native Android integration with Facebook and Twitter where possible.\n\n## Integrating SDK\n\n### Running Sample Application\n\nIn order to run sample application, number of specific settings have to be updated in the code. Open `app/src/main/res/values/strings.xml` file and update the following values:\n- `oneall_subdomain`- OneAll application subdomain from your [application dashboard](https://app.oneall.com/applications/).\n- `facebook_app_id`- Facebook application ID used for authentication.\n- `fb_login_protocol_scheme`- Facebook login protol scheme. generally should be in format \"fb\u003cfacebook-app-id\u003e\", i.e. \"fb1234567890\"\n- `twitter_consumer_key`- Twitter application consumer key from [Twitter Application Settings](http://apps.twitter.com/).\n- `twitter_consumer_secret`- Twitter application consumer secrect from [Twitter Application Settings](http://apps.twitter.com/).\n\nTwitter consumer key and twitter consumer secret are optional and may be omitted if you don't want to use native Android Twitter authentication.\n\n\n### Including Libraries\n\nSDK added to the project with a few lines of code using Gradle.\n\nAfter opening the project, edit `build.gradle` file. Add this to Module-level `/app/build.gradle` before `dependencies`:\n```groovy\n    repositories {\n        mavenCentral()\n        maven { 'https://maven.fabric.io/public' }\n    }\n```\nAdd the compile dependency with the latest version of the OneAll SDK in the `build.gradle` file:\n```groovy\n    dependencies {\n        compile 'com.oneall:oneall-sdk:1.0'\n    }\n```\nSync Gradle and build your project. Now you will be able to use `com.oneall.OAManager` in your code:\n\n```java\n    OAManager\n        .getInstance()\n        .setup(this, \"demo\", TWITTER_KEY_OR_NULL, TWITTER_SECRET_OR_NULL);\n```\nOf course, replace \"demo\" with the subdomain of your OneAll application.\n\n### Setting Up Facebook Integration\n\nThis part is required in order for Facebook login to work correct. The instructions here are similar to [Facebook Android Getting Started Guide](https://developers.facebook.com/docs/android/getting-started) .\n\nAdd your Facebook App ID to your project's strings file and update your Android manifest:\n\n1.  Open `res/values/strings.xml`\n2.  Add a new string with the name `facebook_app_id` and value as your Facebook App ID\n3.  Open `AndroidManifest.xml`\n4.  Add a uses-permission element to the manifest: `\u003cuses-permission android:name=\"android.permission.INTERNET\"/\u003e`\n5.  Add a meta-data element to the application element:    \n\n```xml\n    \u003capplication android:label=\"@string/app_name\" ...\u003e\n      ...\n        \u003cmeta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"@string/facebook_app_id\"/\u003e\n      ...\n    \u003c/application\u003e\n```\n\nNext, setup your Facebook application by creating and setting up development hash as described in **\"Create a Development Key Hash**\" and **\"Setting a Release Key Hash**\" sections of [Getting Started Guide](https://developers.facebook.com/docs/android/getting-started)\n\n### Code Integration\n\nOpen the activity class that will use OneAll integration. Add the following into `onCreate`\n```java\n    import com.oneall.oneallsdk.OAManager;\n    import com.oneall.oneallsdk.rest.models.User;\n    import com.oneall.oneallsdk.OAError;\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // Your initialization code\n        OAManager\n            .getInstance()\n            .setup(this, \"demo\", TWITTER_KEY_OR_NULL, TWITTER_SECRET_OR_NULL);\n        OAManager.getInstance().onCreate(this, savedInstanceState);\n    }\n```\nThis will initialize OneAll module and set it up with your subdomain settings.\n\nNow, pass all activity creation events to the manager:\n```java\n    @Override\n    protected void onResume() {\n        super.onResume();\n        OAManager.getInstance().onResume();\n    }\n    @Override\n    protected void onPostResume() {\n        super.onPostResume();\n        OAManager.getInstance().onPostResume(this);\n    }\n    @Override\n    protected void onPause() {\n        super.onPause();\n        OAManager.getInstance().onPause();\n    }\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        OAManager.getInstance().onDestroy();\n    }\n    @Override\n    protected void onSaveInstanceState(Bundle outState) {\n        super.onSaveInstanceState(outState);\n        OAManager.getInstance().onSaveInstanceState(outState);\n    }\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        OAManager.getInstance().onActivityResult(requestCode, resultCode, data);\n    }\n```\nNext, use the manager to login into OneAll:\n```java\n    OAManager.getInstance().login(this, new OAManager.LoginHandler() {\n        @Override\n        public void loginSuccess(User user, Boolean newUser) {\n            Log.v(\"tag\", String.format(\"OA user %s\", user.identity.name.formatted));\n        }\n        @Override\n        public void loginFailure(OAError error) {\n         Log.v(\"tag\", String.format(\"Failed to login into OA: %s\", error.getMessage()));\n        }\n    });\n```\nThe SDK will show selector of platforms configured for specified OneAll subdomain:\n\n![](https://raw.githubusercontent.com/oneall/android-sdk/master/screenshots/login_providers_selector.png)\n\nYou can use your own native design and login without activating the selector:\n\n    OAManager.getInstance().login(this, \"facebook\", loginHandler);\n\n### Posting Messages onto Wall\n\nIn order to post message `OAManager` provides `postMessage` method:\n```java\n    public void postMessage(\n            String text,\n            String pictureUrl,\n            String videoUrl,\n            String linkUrl,\n            String linkName,\n            String linkCaption,\n            String linkDescription,\n            Boolean enableTracking,\n            String userToken,\n            String publishToken,\n            final Collection\u003cString\u003e providers,\n            final OAManagerPostHandler handler)\n```\nExample usage:\n```java\n    OAManager.getInstance().postMessage(\n            \"Me and the elephant\",\n            \"[](https://drscdn.500px.org/photo/57410272/m%3D2048/9e1b37755cc09022b7eb0993379cc6f6)https://drscdn.500px.org/photo/57410272/m%3D2048/9e1b37755cc09022b7eb0993379cc6f6\",\n            null,\n            null,\n            null,\n            null,\n            null,\n            true,\n            user.userToken,\n            user.publishToken.key,\n            new string[] { \"facebook\" },\n            new OAManager.OAManagerPostHandler() {\n                @Override\n                public void postComplete(Boolean success, PostMessageResponse response) {\n                    if (success) {\n                        Log.v(\"posted message to user wall\");\n                    } else {\n                        Log.v(\"failed to post message to user wall\");\n                    }\n                }\n            }\n    );\n```\nWhere `user` object is the same user object that was received via callback on user authentication earlier in the process. This object implements `Serializable` interface and can be serialized and cached between session to avoid repeated logins on every application run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneall%2Fandroid-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneall%2Fandroid-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneall%2Fandroid-sdk/lists"}