When I wrote android app,I usually need to write server side code.(I used AppFog for the backend)In my experience,before start coding sever side,I should design Model(or said Er model),then I will create data object correspond with design model.And then I start coding the controller for business logic.(My sever side framework using Spring MVC3)If I need to check the data producing from client.I should add new controller and redirect to its match jsp page.
Now the cloud service Parse.com provide an easy way to above process.
Parse.com provide below function:
- Parse Data
- Parse Push
- Parse Social
- Parse Hosting
- Cloud Code
And she give us very lots of implementation:
- iOS/OSX
- Android
- JavaScript
- Window 8/WP8
- .NET
- REST API
Its free quota,I thought that it’s enought for small or tiny business requirement:
- Request: One million/month
- Pushes: Alos one million/month
- Burst Limit 20/second(Ok,I don’t understand what’s that,if u can explain that for me,please tell me,thanks)
Although I did not try all functions,I will tell you that I have already try 2 of the functions in very short time,and that’s very short time I can complete the basis that I need.
First,if you wanna need to do tracing your user what thy do on your app,I thought that you need to get a model(or table) naming “Floating”(my recently new function for my app,I created a Float Window in my app,so my table name called “Floating”,and I let my user whether turn off or turn on this function,when then switch the fuction via the button,the app will send a log to the server),in this model I need to define a class,consist 5 columns,then like I said that I implement a controller and creat a method in controller to make http post to let the app post those fields to the serer.At last I created antoher method to list the created data to a jsp page for showing the datas.After complete above,I turn to android to use HTTPClient to do the client request to send data to server.(HTTPClient code will make you generate about 15~25 lines of code),Now you just only need to do below code
1: ParseObject floating = new ParseObject("Floating");
2: floating.put("device_id", 12345678);
3: floating.put("locale", "zh");
4: floating.put("enabled", false);
5:
6: floating.saveInBackground();
Then the data have sent to Parse.com server to store.Amazing?
Of course,we need other CRUD data controll,please refer this link to do that:https://parse.com/docs/android_guide#objects
Remember?,in parse procedure,we did not do any server side code,right?
when you do save for your data,you can check on the dashboard as below(The picture was my another test,the test only contain one column in client,others was create by parse.com)
Very soon,right?
Another make me suprise thing is push service,in GCM(Google Cloud Message),I need to go to google console to register the service get appId and add at least 4~5 classe in android project,an……..d code lots controllers or classes in server side(3rd Party Server for controll reqister blah blan…) ,now using Parse.com,you just only do very bit time to do that.
- Setup push on android project(Add tag in
AndroidManifest.xml
) - Enable push in java code(or said in your activity)
- Send message on dashboard(need to send register id to Parse.com when completed above 2 steps)
Please refer this link:https://parse.com/tutorials/android-push-notifications
When you edit your message and click Send a push,your device received message immediately(If choose schedule send now,sure,you can book a spacify time to send that,but you need to upgrade to pro version)
Very soon,right?
Other functions,I did not try.But I thought Parse.com really eliminate lots of comprehensive complex job for us,go to sign up a new account and try it.
And when you go to facebook developer site,we can see facebook have already acquired Parse.com. Nice news.
沒有留言:
張貼留言