Wednesday, November 18, 2015

Parse.com Android : Common Issues faced

If you have just started in the world of BASS service, you might have chosen Parse.com.
Although it has good tutorial for explaining things, still I think community support is not very good.
I also had hard time to try basic things. So let me share a complete tutorial for extracting some data from Parse.com. It will be more towards covering the known issues.

Step 1: Uploading Data
In Tutorial provided by Parse, they talked how you can create a ParseObject, and upload the data by putting.You can follow the Guide provided by Parse to do that. I instead use Import Data option in Data Browser. So create a Json file and upload it there. If you are facing any issue with uploading, like it should be in that particular format, I will suggest to download any existing Table such as User, and open the JSON file. Similar way you can do it. Remember the first name should be "results" only, otherwise it wont let you upload.

Step 2: Creating a subclass of ParseObject
Although you can use normal ParseObject class do that, I will suggest you to use your own customized subclass of ParseObject.
a) Use @ParseClassName("YOUR_CLASS_NAME")  annotation.
b) Keep the file name, class name and Table Name same.
c) There should be default constructor of your customized sub-class.
d) Create set/get method for your fields in the table.

Step3: Registering the subclass
In your Application class's onCreate() method: add this line before calling Parse.initialize() :
ParseObject.registerSubclass(YOUR_CLASS_NAME.class);

Step4: Query using the subclass
 ParseQuery query = Alert.getQuery();
query.findInBackground(); //see the last link to get the full code.

Step5: Manifest changes
a) Please make sure you have defined the name field in tag in AndroidManifest.xml. Better use the complete path.
b) Add android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE permission.

I think this covers pretty much all the points.  Let me know if you face any issues with it. Sorry for lousy writing.
Here is link for all code.



Wednesday, November 4, 2015

Unable to add Google Play Service or Appcompat library project

It has been very long since I wrote any post about Android. So I will try now to continue the writing.

If you have left Android for some time and now starting over again. You might observe that Google is no longer providing ADT (Android Development Tool) bundle. Now the new tool is Android Studio. Although it has all the related tools at one place, but it is slow and little bit hard to start with.

So here is the guide for using old ADT.
Download the last ADT bundle. I am using adt-bundle-windows-x86_64-20140702.
You will find that it doesnt have Google Play Services project. To install it:
1. Go to Sdk Manager. Its there in the same zip file of adt bundle.
2. Refresh the list, in last checkbox named Extras: you can see one sub-item Google Play Services.
3. Check it and install it.
4. You can see that now a folder has been created in the \sdk\extras\google\google_play_services.
5. Now go to eclipse, Import Android project and give the location to this google_play_services folder. Don't forget to Check the Copy Projects into workspace option.
6. That's it.

Now if you want to include this project in your App's Project. Just go to project settings. In Android Option, there is a option to Add, Click on it, it will be showing your play-service/appcompat project.
choose whichever is relevant to you.

The same process could be followed for Appcompat Project.

If you face any other issue, comment here or mail me @ rahul.lnmiit@gmail.com