Month: December 2015

Android Studio – Git ignore files

Hi Folks,

This post is for people who are working on Android Studio Project in conjunction with Git.

I used to develop Android Apps in eclipse initially. I saw many people using Android Studio in stack overflow posts. Even my friend(Abhinav) has suggested to try Android Studio. I too got habituated using Git for all the projects. I consider Git is a breakthrough solving numerous problems. While learning to work on Android Studio, one main problem which I faced was setting the files to be tracked by git. So, below is the .gitignore file which suited me best.

.gradle
local.properties
/.idea
.DS_Store
/build
/captures
TestApp.iml
app/build
app/app.iml
app/src/main/gen

I do understand that if above files are are ignored, its not possible for someone to clone the project and get started easily. In such cases, compress it and just send the project or create another repository.

If above mentioned files are not ignored, each time you make changes to remote repo, your team-mates need to struggle to get the updated project working.

Advertisements

App Stores – Difficulties

Android:

As far as I can remember everything was straight forward for Android and documentation was very helpful. Android studio is rich in terms of features but still not completely evolved, often reports bugs, freezes. One major problem(Android not to be blamed here though, just the file structure) that I struggled with was getting the .gitignore file right. Its a common practice to use git(Version control) for all projects.  Click here to checkout my other post about .gitignore file for android studio project.

To sign the apps, you need to create a keystore file and then use the password. There is an option in Android Studio – “Generate Signed APK” under build menu item to sign the apps. Generated Release Apk  file will be at this location –  ProjectRoot/app/app-release.apk . As soon as you upload your app, it gets validated and goes live in a day.

There is a scope to improve the supported devices functionality. Right now when you upload your app, it shows a list of devices supported by your app (excluded devices too). It would be great if we can know exactly which permission in Android Manifest is making the devices unsupported. We need to compile multiple times and check to support maximum devices.

IOS:

Register for Developer Program, add the credentials to Xcode. Best thing was, we can run app validation tests locally and then upload App file to App store with just a button click. You need to fill in the App details and submit for review in Itunesconnect App Store.

Everything was smooth with IOS too. Only problem was the time taken to verify apps. I read in other blogs that avg. time is around 8 working days. There is a provision to speed up this process to 2 working days, called as Expedited reviews. As one can expect, it is like a lifeline, granted to people only upon checking reasons and that too only once in a while.

Windows:

I really can’t describe the trouble I’ve been through just to complete the payment process. And yeah, till date i’ve tried around 15-20 times to pay using 7-8 different cards and 2 different live accounts but still could not get through. All I see is an error message which does not even indicate exact problem. There is a “contact us” link along with error message which is broken. I can only say that this is an epic failure of Microsoft. They are not in a state to receive money when people are ready to pay (for Developer Account).

UPDATE:  After several desperate days.. one day I got an email from Microsoft team with a coupon.  They have smoothened my pain a bit with that free coupon for developer account. It was easy to upload app and submit from there on. Only other problem was, compiling for different versions of windows 😐

I’ve initially compiled my app into .xap format for windows 8 devices. Later I realized that to support windows phone 8.1+ devices, I need to compile into .appx format and for this I need a windows 8.1+ device (I was like, holy ****).

Blackberry:

Signing the app is not so easy but with some attention, we can get it done. You need to request signing keys and place it in specific location as described in documentation. “authout.p12, bbidtoken.csk” are the two file you would be needing to sign the application.

Real mess started only after this step. When I tried to fill up the details in vendor portal, I realized that, it is one of the lame portals I’ve ever seen. Content Rating popup is not working, there are 4/5 form submission need to be made which are always resulting in errors. Event the error messages are not understandable sometimes. I’ve been struggling to get it done.

Conclusion:

No wonder why some companies are not even building windows and blackberry applications. Applications are like pillars to every operating system. If the process is so tough, how long can they sustain.

Cordova Whitelist Cross-domain request issue

Hi Folks,

As I mentioned somewhere in my previous posts,  installing whitelist plugin for cordova(5.0+) platforms in now compulsary to get server call working. In config.xml file add below line-

<access origin=”*” subdomains=”true” />

Above will ensure ajax requests happen properly on Android, IOS and Windows phones. But Blackberry10, it needs one more fix. Without adding below line, I was able to make a server call but only OPTIONS request was being received. As soon as the response is received, blackberry browser is blocking the server calls treating it as Cross-Domain request.

<preference name=”websecurity” value=”disable” />

You need to disable websecurity by adding above line to your config.xml file to get it working for Blackerry10. I’ve seen few posts mentioning this should not be used in production but as of now, I could not find any alternative. I’ll update this post shortly if I find anything better.

Cookie Manager – Android

Hi folks,

For an android application I was working on, I was using session authentication. For that we need cookies to work. In order to fix that, I was storing Set-cookie headers from server responses and adding cookies to each request.

Everything is working fine. Later I realized that I need to extend session expiry time for App Users as it won’t be good UX to ask App users to login every month.(Most of them would not even care to remember their passwords). So I considered to extend user session expiry time when they make specific request to server. I’ve changed expiry date on server side upon user making a specific request(which will happen automatically as soon as the users opens the App). I’ve tested in on website and everything was very much fine.

Here comes the important matter, After few days I was seeing many people getting logged out. After tracing each step, I realized that, CookieManager will store expiry date too and when accessed, getCookies method will give only cookies which did’nt expire.  Finally I saved all cookies and the problem got fixed.

Take aways : No matter how small things you are working on .. each time you make some change to production level code, you need to test the complete feature from end to end just exactly how an end user will see it. I have many times overlooked this fact and found myself in embarrassing situations. I agree that sometimes we need to simulate and create environments to test properly but trust me, its totally worth it.