CATCH LOC Developers

Login

Installation and Get started

Permission Settings


            <uses-permission android:name="android.permission.INTERNET" />
            

Add Library (CatchLocSDK.jar Download)


            Add the downloaded CatchLocSDK.jar file to the app/libs folder.
            If you see the file in Android Studio, right click on it and run'Add as Library'.

            You can check the added SDK in the build.gradle file.

            implementation files('libs/CatchLocSDK.jar')
            

Creating Instance and initialization


            Inject API key and server key to SDK to initialize SDK instance.

            CatchLoc catchloc = new CatchLoc();

            catchloc.setApiKey("API KEY");
            catchloc.setServerKey("SERVER KEY");

            or

            catchloc.setApiKey("API KEY").setServerKey("SERVER KEY");

            or

            CatchLoc catchloc = new CatchLoc("API KEY", "SERVER KEY");


            After initialization, you can run SDK functions that call APIs.
            

Handle Result (Example)


            It is recommended to use an async task, etc. so as not to affect the UI thread.

            class CatchLocAsyncTask extends AsyncTask<Void, Void, JSONObject> {
                @Override
                protected JSONObject doInBackground(Void... params) {
                    CatchLoc catchloc = new CatchLoc("API KEY", "SERVER KEY");

                    return catchloc.getLastData("member_key");
                }

                @Override
                protected void onPostExecute(JSONObject response) {
                    1. Check the result value 'ok' in response
                    2. Check the type in response (jsonobject or jsonarray)
                    3. Processes the result value according to the type value.

                    JSONObject item = response.getJSONObject("message");

                    or 

                    JSONArray items = response.getJSONArray("message");
                }
            }




            Create member variables and constructors according to the flow of the program you are creating, and run threads.

            CatchLocAsyncTask catchLocAsyncTask = new CatchLocAsyncTask();
            catchLocAsyncTask.execute();