General information
Github repository: ok-android-sdk
Android application with OK SDK example: ok-android-sdk/odnoklassniki-android-sdk-example
Android SDK allows to authorize users via client authorization, publish new posts, invite friends to a game, send notifications and invoke REST methods.
Setting up
Before using SDK you need to be sure everything is configured correctly for your app:
- Android platform is added to your app’s platforms list;
- client authorization is enabled;
- redirect_uri okauth://ok{APP_ID} is added to redirect_uri’s list;
- application has all required API permissions. It is recommended to have LONG_ACCESS_TOKEN permission enabled for native apps.
To import it with gradle do the following:
- add this code to dependencies part of build.gradle file
Correct your AndroidManifest.xml file:
- enable INTERNET permission
- add OAuth Activity and set your app’s APP_ID to the value
- in case of using widgets add specific Activities for each widget to be used
SDK usage example
Creating Odnoklassniki object instance
Authorization (requestAuthorization)
REST method invocation (request)
Widgets
- Publish widget - performPosting
- invite / suggest widget - performAppInvite / performAppSuggest