Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,123 members, 7,814,939 topics. Date: Thursday, 02 May 2024 at 12:28 AM

Android Developers : Building Your Android Library And Add It To Maven Central - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Android Developers : Building Your Android Library And Add It To Maven Central (4937 Views)

Android Developers Group / Kotlin For Android Developers By Antonio Leiva" Ebook(pdf). / New Android Library (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 8:19am On May 24, 2016
efreaky:


Simple!

1. Create a normal Login/Registration with Laravel
2. Use JSON to parse your data
3. Use an Android Library like volley to consume the JSON data

Or Better still

1. Google how to create an API with Laravel
2. Google how to use Volley in Android.

Thank you, Good morning.

How can I create the Login and Register API?
Can you show me a code spinet?

Like I said, I have Google it, but couldn't find it.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by lekropasky(m): 8:40am On May 24, 2016
I finally found a library called android-async-http, i think the library is OK because the popular Instagram uses the Library...Thanks Bro @dhtml18
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 8:46am On May 24, 2016
^^^I have used it before, to build a chat app with android. I have also used volley and quite a lot of libraries in android.
But somehow, i will recommend volley rather than android-async-http.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by lekropasky(m): 8:55am On May 24, 2016
FrankLampard:


Thank you, Good morning.

How can I create the Login and Register API?
Can you show me a code spinet?

I dont think theres any need to use a Framework for this kinda task, though, i am not a PHP guy, but simple PHP script that can talk to database and echo a JSON String is all you need to write.

Example...for registration:

<?php
$host = 'localhost';
$user = 'root';
$pass = ' ';
$connection = mysql_connect($host, $user, $pass);
mysql_select_db(
'db name');
//user data
$username = $_POST['user'];
$mail = $_POST['email'];
$password = $_POST['password'];
$json = array();
$query = Insert into users( username, email, password) Values( '$username','$mail','$password')
$result = mysql_query($query);
if($result){
array_push($json, array('success'=>true, 'fail'= >false))
}else{
array_push($json, array('success'=>false, 'fail'= >true))
}
mysql_close($connection);
echo json_encode($json);?>
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 9:27am On May 24, 2016
lekropasky:


I dont think theres any need to use a Framework for this kinda task, though, i am not a PHP guy, but simple PHP script that can talk to database and echo a JSON String is all you need to write.

Example...for registration:

<?php
$host = 'localhost';
$user = 'root';
$pass = ' ';
$connection = mysql_connect($host, $user, $pass);
mysql_select_db(
'db name');
//user data
$username = $_POST['user'];
$mail = $_POST['email'];
$password = $_POST['password'];
$json = array();
$query = Insert into users( username, email, password) Values( '$username','$mail','$password')
$result = mysql_query($query);
if($result){
array_push($json, array('success'=>true, 'fail'= >false))
}else{
array_push($json, array('success'=>false, 'fail'= >true))
}
mysql_close($connection);
echo json_encode($json);?>

Thank you.

With simple PHP script, I can create an API anyway I want. Outputting my response anyway I want, but for this particular project I need Laravel to perform the task for me.

Again Thank you.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 9:56am On May 24, 2016
FrankLampard:

Thank you, Good morning.
How can I create the Login and Register API? Can you show me a code spinet?
Like I said, I have Google it, but couldn't find it.
Are you using Laravel 4 or 5?
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 10:12am On May 24, 2016
I believe i completely agree with the dude that says that there is no need to use laravel for a simple json api. The lighter the api, the better for your app.
This means that, you can build your website with wordpress, codigniter or whatever, but you can still build a simple json api on top of that with regular php.
afterwall, what does the api really need? to push and pull data between the app and the server (database).
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 10:28am On May 24, 2016
efreaky:

Are you using Laravel 4 or 5?
5. here is my own code.

Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 10:29am On May 24, 2016
dhtml18:
I believe i completely agree with the dude that says that there is no need to use laravel for a simple json api. The lighter the api, the better for your app.
This means that, you can build your website with wordpress, codigniter or whatever, but you can still build a simple json api on top of that with regular php.
afterwall, what does the api really need? to push and pull data between the app and the server (database).

API with a framework really helps in so many ways.

Security, Scalable and Performance.

1 Like

Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 10:33am On May 24, 2016
FrankLampard:


5. here is my own code.


https://www.codetutorial.io/laravel-5-rest-api-basic-authentication/

There you go, dont forget to pay tithe when your client pays you.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 12:02pm On May 24, 2016
FrankLampard:


API with a framework really helps in so many ways.

Security, Scalable and Performance.
I know all that, but can't you secure your API? Even with the most secure of frameworks, if you do not follow some certain guidelines your app will still be vulnerable.
If you do not secure your android app properly, a smart hacker can decompile it and still hack your api even with the most secure of frameworks.

Lesson: securing this type of API/android app is not beans or moi moi at all.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 12:09pm On May 24, 2016
dhtml18:

I know all that, but can't you secure your API? Even with the most secure of frameworks, if you do not follow some certain guidelines your app will still be vulnerable.
If you do not secure your android app properly, a smart hacker can decompile it and still hack your api even with the most secure of frameworks.

Lesson: securing this type of API/android app is not beans or moi moi at all.

ProGuard can help you with that, even without ProGuard, if someone decompiled your app and get your API and try to do basic SQL injection to your App. The hacker will be extremely disappointed. When you used Laravel.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 1:59pm On May 24, 2016
FrankLampard:


API with a framework really helps in so many ways.

Security, Scalable and Performance.
yes i am very aware of all that. But i dont really wish to talk too much on this matter, because it will lead to countless arguments which i am not truly ready to face.

The thing is, you wish for a json laravel api to use for your solution - and you have got it - case closed then.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 7:26pm On May 25, 2016
efreaky:


https://www.codetutorial.io/laravel-5-rest-api-basic-authentication/

There you go, dont forget to pay tithe when your client pays you.

I didn't reply you because I was banned by the Anti-spam bot.

I have actually seen this tutorial before. It does not solve my problem.

I had to come up with my own Hack within Laravel.

Thank you.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 7:43pm On May 25, 2016
FrankLampard:

I didn't reply you because I was banned by the Anti-spam bot.
I have actually seen this tutorial before. It does not solve my problem.
I had to come up with my own Hack within Laravel.
Thank you.
Nice to know you finally found a way around it, care to share how you did it?
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 7:44pm On May 25, 2016
^^^Very good, i believe you should share it so that it can help others someday.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 7:49pm On May 25, 2016
efreaky:


Nice to know you finally found a way around it, care to share how you did it?

Where I go start now.

Well creating an API is not different from the normal way of creating Web Applications.

In Laravel instead of Returning Views within your route.php, you just return json(). It will solve your problem with breeze.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 7:52pm On May 25, 2016
dhtml18:
^^^Very good, i believe you should share it so that it can help others someday.

I had to use Normal PHP script within Laravel to solve the task.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 8:13pm On May 25, 2016
FrankLampard:


I had to use Normal PHP script within Laravel to solve the task.
^^this was exactly the scenario i was trying to paint earlier. . . .
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 8:30pm On May 25, 2016
dhtml18:

^^this was exactly the scenario i was trying to paint earlier. . . .

It seems almost impossible for me to achieve it with Eloquent, I had to use Query Builder.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by oluwaskulboy(m): 9:45pm On May 25, 2016
DEVELOPING AN ANDROID APP, WHAT YOU SHOULD KNOW. http://techzone.com.ng/2016/05/05/developing- android-app-know/
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 3:08pm On May 26, 2016
FrankLampard:


Where I go start now.

Well creating an API is not different from the normal way of creating Web Applications.

In Laravel instead of Returning Views within your route.php, you just return json(). It will solve your problem with breeze.

Good to see you took my initial advise. Lol
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 8:34pm On May 26, 2016
efreaky:

Good to see you took my initial advise. Lol
No I didn't, the screenshot I pasted was working fine, just didn't know that.

1 Like

Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 6:03pm On May 28, 2016
lekropasky:
I finally found a library called android-async-http, i think the library is OK because the popular Instagram uses the Library...Thanks Bro @dhtml18
I was just revamping an android app now and found out that volley was no more getting maintained, so i am porting back to android-async-http
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 6:36pm On May 28, 2016
dhtml18:

I was just revamping an android app now and found out that volley was no more getting maintained, so i am porting back to android-async-http

Have you looked at Retrofit?

http://square.github.io/retrofit/
Re: Android Developers : Building Your Android Library And Add It To Maven Central by lekropasky(m): 6:44pm On May 28, 2016
dhtml18:

I was just revamping an android app now and found out that volley was no more getting maintained, so i am porting back to android-async-http

the library is great. what I like most about it is the easy way of sending FILES to http server using the RequestParams class....
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 7:02pm On May 28, 2016
FrankLampard:

Have you looked at Retrofit?
http://square.github.io/retrofit/
Probably another time, I am more used to volley and async-http. I hear it is highly recommended, I shall try it in a new project.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 7:08pm On May 28, 2016
lekropasky:


the library is great. what I like most about it is the easy way of sending FILES to http server using the RequestParams class....
Yes it is, in this case i am using it for a post request to fetch data from a JSON API (done in .NET).

So back to original thread, is there anyone here that wishes to learn how to create a reusable library in your code?
Just like all these libraries that we use - asynchttp etc, you can create a reusable library on your pc that you can use in multiple projects - call it shared library if you like.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 11:28am On May 31, 2016
Pls what is wrong, I can't install HAXM, even though I enable Virtualization and disabled Hyper-V.
It so annoying. It is saying "Unknown Error". I use Win10.

Has anyone experienced similar problem?
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 11:42am On May 31, 2016
O boy, i never install that one o. In fact, i dont really use those stuffs jare. I mostly use bluestack, andy, genymotion and my phone and tab to test. E don tale wey i don use all those emulators last.
And i am using windows 8 too - refused to upgrade to 10 - too many things at stake. When i buy a new laptop, i will put windows 10 on it.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by FrankLampard: 12:10pm On May 31, 2016
I wanted to do some test on my localhost. That is why I needed the Android Emulator.

I will try and download Genymotion.

Or is there a way I can use to my phone to connect to MySQL on my localhost using WiFi or Cable.
Re: Android Developers : Building Your Android Library And Add It To Maven Central by Nobody: 12:36pm On May 31, 2016
When using bluestacks emulator - http://localhost/nairaland becomes http://10.0.2.2/nairaland in your emulator
but some other types of emulators like genymotion - it becomes http://10.0.3.2/nairaland

(1) (2) (3) (Reply)

Complete Array Of Countries And Nigerian States [open Source] / Operation Prove Your Programming Skills / An Insomniac's Puzzle For Programmers.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 40
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.