Saturday, March 21, 2015

Apache Cordova - Run Android app with VisuaStudio on Mac


Hello all,

    Today I am going to show you how to develop for Android using Apache Cordova on my MAC. I will also follow here all pre-requirements as well as providing the most common errors in order to help you to reach your goal - launch your Android app on Mac.

So, the first thing is install the dependencies for it:
1-Node.JS

1.1-Download and Install Node.JS for Mac:  https://nodejs.org/en/download/

1.2- Follow the steps and complete successfully your NodeJS installation.
1.3- Make sure you add the npm as well as the node paths over your .bash_profile to avoid issues.
2- Install Apache Cordova using npm.

3-Hit Command +P on your Visual Studio IDE code and run Cordova:Prepare .


4-Now the common issues you might have:

4.1- FIRST COMMON ERROR: ANDROID_HOME not defined:

The fix is make sure you have your Android-sdk installed and set as environment variable, check the next picture.



4.2- SECOND COMMON ERROR: Another very common issue is when you are developing for multiple emulators, sometime you are testing android and your environment platform is set for IOS as below - during cordova prepare command:

Error: The provided path "/blablabla/" is not a Cordova iOS project.


Fix:
The fix for this is just go to your project home folder and run these commands:
- cordova platform rm ios (to remove IOS)
- cordova platform android(to add Android)


Now your Error: THe provided path "blablabla" is not a Cordova iOS project is fixed.

4.3- THIRD COMMON ERROR:
Running command: /Users/ThiagoGuimaraes/workspace/myapp/platforms/android/cordova/build 
[Error: Please install Android target: "android-22".

Hint: Open the SDK manager by running: /Users/ThiagoGuimaraes/adt-bundle-mac/sdk/tools/android
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: /Users/ThiagoGuimaraes/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/ThiagoGuimaraes/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2"
F
Fix:

   Make sure you have all required Android packages installed on your MAC running the command:

- [ANDROID-SDK-HOME]/tools/android as below:


Command +P : Cordova Build should work fine now as below:
4.4- FOURTH COMMON ERROR:
During the cordova run command you hit error related of emulator such as:

/tguimaraesMacpro/platforms/android/cordova/node_modules/q/q.js:126
                throw e;
                      ^
ERROR : No emulator images (avds) found.


Fix:
  To fix this one you must create an ADV running this command on your terminal window.
/us/local/Cellar/android-sdk.24.4.1_1/tools/android adv






Now, finally, you are good to run your cordova: run command.





Then......your app in Apache Cordova finally launched to the mobile universe!!!


Please, find more about Apache Cordova here:





Happy coding. I hope it helps you, and talk to you soon.

Thiago Leoncio. 


Saturday, March 14, 2015

IOS Developer - UIView Controller Lifecycle iOS 6 and onward

Hello everybody,

      Today I just would like to show you guys the new IOS 6 lifecycle for UIView. So, first let's go to the picture.




Then the explanation - there are six different stages which makes the lifecycle of a UIViewController. I've listed them according to the order. 
  1. loadView 
  2. viewDidLoad
  3. viewWillAppear
  4. viewWillLayoutSubviews
  5. viewDidLayoutSubviews
  6. viewDidAppear
Let me explain all those stages. 
1. loadView
This event creates the view that the controller manages. It is only called when the view controller is created programmatically. That means, it makes a good place to create your views in code. 
2. viewDidLoad
The viewDidLoad event is only called when the view is created and loaded in memory. But the bounds for the view are not defined yet. That means it's good place to initialize the objects that the view controller is going or can use.
3. viewWillAppear

This event communicate to the view controller 'saying' to it, when the view will appear on the screen. In this step the view has bounds that are defined but the orientation is not set. 
4. viewWillLayoutSubviews
If you are not using constraints or Auto Layout you probably want to update the subviews in here.
This is the first step in the lifecycle where the bounds are finalized. 
5. viewDidLayoutSubviews
Subviews have been setup and it notifies the view controller of it. It is a good place to make any changes to the subviews after they have been set. 
6. viewDidAppear
This viewDidAppear event comes just after the main view is presented on the screen.That makes it a perfect place to get data from a backend service or database using, for example JSON or connecting to NOSQL.

Happy coding,
Thiago.

Thursday, March 12, 2015

Protecting users and their emails after FA-P2T on Cloud environments

Hello everyone,

       The P2T – Prodution to Test – procedure is a very popular feature that FA customers utilize. It allows them to have their production data copied to another environment. Nowadays, P2T is a very common cloud SAAS and on-premise procedure. An important aspect that is not discussed frequently is the post-process of P2T. This approach is very important to avoid security issues, such as production passwords and emails being available in a different environment.

Please find all details here:

http://www.ateam-oracle.com/protecting-users-and-their-emails-after-fa-p2t-on-cloud-environments/


Note: this article is to show for on-premise members how-to do this, anb for Cloud members that this feature is possible. Means that probably you have to raise a SR and ask for approvals in order to do that.

I hope it helps you,
Thiago Leoncio.