Giter VIP home page Giter VIP logo

android-sdk's Introduction

Bulutfon Android SDK

Bulutfon API'ye erişmek için Android SDK'sı.

Kullanım

	public class MainActivity extends AppCompatActivity {
	    private Detail detail;
	    private ArrayList<Message> messages;
	    private ArrayList<MessageTitle> messageTitles;
	    private Message message;
	    @Override
	    protected void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.activity_main);
	        try {
	            BulutfonConfig config = new BulutfonConfig("MASTER TOKEN");
	            //BulutfonConfig config = new BulutfonConfig(AuthType.CREDENTIALS, "email", "password");
	            Bulutfon bulutfon = new Bulutfon(config);

	            //region USER DETAIL
	            bulutfon.userDetail().getDetail(new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    detail = new Detail(response);
	                }
	            });
	            detail = bulutfon.userDetail().getDetailSynched();
	            //endregion

	            //region MESSAGE TITLE
	            bulutfon.messageTitles().getMessageTitles(new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    messageTitles = MessageTitle.getMessageTitlesList(response);
	                }
	            });

	            messageTitles = bulutfon.messageTitles().getMessageTitlesSynched();
	            //endregion

	            //region GET MESSAGE LIST
	            RequestParams params = new RequestParams();
	            params.add("limit", "10");
	            bulutfon.messages().getMessages(params, new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    messages = Message.getMessagesList(response);
	                }
	            });

	            messages = bulutfon.messages().getMessagesSynched(null);
	            //endregion

	            //region MESSAGE DETAIL
	            bulutfon.messages().getMessage(27599, new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    try {
	                        message = new Message(response.getJSONObject("messages"));
	                    } catch (JSONException e) {
	                        e.printStackTrace();
	                    }
	                }
	            });

	            message = bulutfon.messages().getMessageSynched(27599);
	            //endregion

	            //region SEND MESSAGE
	            ArrayList<MessageRecipient> recipients = new ArrayList<>();
	            recipients.add(new MessageRecipient("908508850000"));
	            message = new Message("TITLE", "CONTENT", recipients);
	            bulutfon.messages().createMessage(message, new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    RequestResult result = new RequestResult(response);
	                }
	            });

	            RequestResult result = bulutfon.messages().createMessageSynched(message);
	            //endregion

	            //region GET CDR LIST
	            bulutfon.cdrs().getCdrs(null, new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    cdrs = Cdr.getCdrsList(response);
	                }
	            });

	            cdrs = bulutfon.cdrs().getCdrsSynched(null);
	            //endregion

	            //region GET CDR
	            bulutfon.cdrs().getCdr("UUID", new BulutfonHttpResponseHandler() {
	                @Override
	                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
	                    cdr = new Cdr(response);
	                }
	            });

	            cdr = bulutfon.cdrs().getCdrSynched("UUID");
	            //endregion

	        } catch (BulutfonAuthException e) {
	            e.printStackTrace();
	            Log.e("Bulutfon Exception", "Bulutfon Auth EXCEPTION");
	        } catch (JSONException e) {
	            e.printStackTrace();
	            Log.e("Bulutfon Exception", "JSON EXCEPTION");
	        }
	    }
	}

android-sdk's People

Contributors

hamitturkukaya avatar

Stargazers

Onur Ozgur OZKAN avatar

Watchers

Onur Ozgur OZKAN avatar James Cloos avatar Hakan ERSU avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.