dreamfactorysoftware / android-sdk Goto Github PK
View Code? Open in Web Editor NEWAn address book app for Android showing user registration, user login, and CRUD.
An address book app for Android showing user registration, user login, and CRUD.
Hi,
After I managed to overcome the previous issue of not able to add the src folder, now I face a similar issue. The issue is this.
After I export the project from eclipse, this is to migrate to gradle from ant (as the current project is in Github), I am having hard time getting the src folder to be imported to the project even though I sucessfully managed to import in to android studio and utilizing gradle now.
Tried importing the project in to eclipse.
But I think it is not importing the .java files from the src folder. Please assist on how to.
It would be a great help for everyone if you could just upload the Android Studio version as it is the official IDE for Android moving forward. Tks
I noticed the example is extending Application
in DreamFactoryApp.java. As far as I know this isn't really best practice. It would be better to do the following:
Pass the context when getting an instance:
public class DreamFactoryAPI {
private static DreamFactoryAPI INSTANCE;
private final Context mContext;
private Retrofit retrofit;
private OkHttpClient httpClient;
private static Converter<ResponseBody, ErrorMessage> errorConverter;
public static String testToken;
public static Boolean runningFromTest = false;
public static DreamFactoryAPI getInstance(@NonNull Context context) { //context passed in here
synchronized(DreamFactoryAPI.class) {
if (INSTANCE == null) {
INSTANCE = new DreamFactoryAPI(context);
}
return INSTANCE;
}
}
private DreamFactoryAPI(@NonNull Context context) { //context is part of the constructor
mContext = context.getApplicationContext();
httpClient = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
// existing code
}
Then in the in the activity just pass this
context when making a call to the DreamFactoryAPI.
final AuthService service = DreamFactoryAPI.getInstance(this).getService(AuthService.class);
Then move some of the normal saved data like the session
to a normal public interface
class for shared preferences.
Hi,I am trying to play with this example to see what is possible but getting the error:
Authentication error: Unable to respond to any of these challenges: {}
When I try to add new contacts in the contact table using AddContactTask: Below is is the output I am getting,any pointers on what I might be doing wrong?
invokeAPI() called with: host = [https://df-ft-wayadn.enterprise.dreamfactory.com/api/v2], path = [/db/_table/contact], method = [POST], queryParams = [null], body = [{"first_name":"Gakwaya","twitter":"Twitt","image_url":"Image.png","last_name":"Daniel","notes":"Note","skype":"nSkype","id":51}], headerParams = [{X-DreamFactory-Session-Token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjMsInVzZXJfaWQiOjMsImVtYWlsIjoid2F5YWRuODhAZ21haWwuY29tIiwiZm9yZXZlciI6ZmFsc2UsImlzcyI6Imh0dHBzOlwvXC9kZi1mdC13YXlhZG4uZW50ZXJwcmlzZS5kcmVhbWZhY3RvcnkuY29tXC9hcGlcL3YyXC91c2VyXC9zZXNzaW9uIiwiaWF0IjoxNDYzOTc0MjM2LCJleHAiOjE0NjM5Nzc4MzYsIm5iZiI6MTQ2Mzk3NDIzNiwianRpIjoiNWIwODRlYThlZmZlZTBhZTUxYzdjMmQ4ZThkMDdmYzYifQ.9mfHzj_01-Ib5poK8TniJ9KEjC2_0ANb-2QaxLR2D2g, X-DreamFactory-Api-Key=20bd49da217c202bbef4f02b5c048703a9yyyyyyyyyyf57e096c1dad34934970}], contentType = [application/json], fileRequest = [null] 05-23 14:42:38.706 28430-28495/com.blikoon.dreamfactorytest W/DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {} 05-23 14:42:38.716 28430-28495/com.blikoon.dreamfactorytest E/AddContactTask: going to on_failure() for an ApiException 05-23 14:42:38.716 28430-28495/com.blikoon.dreamfactorytest E/AddContactTask::baserequest::onError: com.blikoon.dreamfactorytest.dfapi.ApiException: {"error":{"context":null,"message":"Token has expired","code":401,"trace":["0 [internal function]: DreamFactory\\Http\\Middleware\\AccessCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))","1 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9511): call_user_func_array(Array, Array)","2 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))","3 /var/www/_releases/instance/dreamfactory/2.0.4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))","4 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))","5 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9501): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))","6 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9025): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))","7 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9012): Illuminate\\Routing\\ControllerDispatcher->callWithinStack(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'handlePOST')","8 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(8099): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'DreamFactory\\Ht...', 'handlePOST')","9 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(8086): Illuminate\\Routing\\Route->runController(Object(Illuminate\\Http\\Request))","10 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(7800): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))","11 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))","12 /var/www/_releases/instance/dreamfactory/2.0.4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))","13 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))","14 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9501): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))","15 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(7801): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))","16 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(7792): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))","17 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(7782): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))","18 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(2393): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))","19 [internal function]: Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))","20 /var/www/_releases/instance/dreamfactory/2.0.4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))","21 /var/www/_releases/instance/dreamfactory/2.0.4/vendor/dreamfactory/df-managed/src/Http/Middleware/ClusterAuditor.php(45): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))","22 [internal function]: DreamFactory\\Managed\\Http\\Middleware\\ClusterAuditor->handle(Object(Illuminate\\Http\\Request), Object(Closure))","23 /var/www/_releases/instance/dreamfactory/2.0.4/bootstrap/cache/compiled.php(9511): call_user_func_array(Array, Array)","24 [in
Does the DF API code support SSL? Are there any docs on DF Andoid SDK security?
The API should probably have some notes about SSL because the app is sending user passwords...
Especially because it's quite easy to support SSL on the bitnami image.
The RegisterTask doesn't handle passwords that are too short. The DF REST API requires a minimum of 6 characters in the password (oddly you can break this rule from the DF Admin Console, bug?).
Should this be checked directly in the Android text field? Or should the DF API throw an exception that the password is too short?
Another small note. If you don't set the DF instance user service: Open Reg Email to blank, the "login" queryParams won't actually work because confirmation is required.
Android API 23 has deprecated Apache client HTTP library. HTTP client should be replaced with HttpURLConnection. Unfortunately it might be a big change and not implemented for a while, but I figured I should make it an issue. That way other people who are reading this that try to implement the DF android SDK in Android 6.0 (API 23) know why gradle complains.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.