Friday, December 9, 2016

Adobe Analytics Implementation and Lifecycle

Adobe Analytics Implementation and Lifecycle

Get the SDK
Requires iOS 6 or later

  • ADBMobile.h: The Objective-C header file used for iOS AppMeasurement.
  • ADBMobileConfig.json: SDK configuration file customized for your app.
  • AdobeMobileLibrary.a: A bitcode-enabled fat binary containing the library builds for iOS devices (armv7, armv7s, arm64) and simulators (i386, x86_64). Should be linked when target is intended for an iOS app.
  • AdobeMobileLibrary_Extension.a: A bitcode-enabled fat binary containing the library builds for iOS devices (armv7, armv7s, arm64) and simulators (i386, x86_64). Should be linked when target is intended for an iOS extension.
  • AdobeMobileLibrary_Watch.a: A bitcode-enabled fat binary containing the library builds for Apple Watch devices (armv7k) and simulators (i386, x86_64). Should be linked when target is intended for an Apple Watch (watchOS 2) extension app.
  • AdobeMobileLibrary_TV.a: A bitcode-enabled fat binary containing the library builds for new Apple TV devices (arm64) and simulator (x86_64). Should be linked when target is intended for an Apple TV (tvOS) app.

Note: If you download the SDK outside of the Adobe Mobile services UI, the ADBMobileConfig.json must be manually configured. If you are new to Analytics and the mobile SDK, we highly recommend using the steps in Before You Start to set up a development report suite and download a pre-populated version of the configuration file. Configuration is not difficult, but it can be a source of frustration when you are getting started.
Add the SDK and Config File to your Project

  • SystemConfiguration.framework
  • libsqlite3.0.tbd
  • AdobeMobileLibrary.a
  • SystemConfiguration.framework
  • libsqlite3.0.tbd
  • AdobeMobileLibrary_Extension.a
  • libsqlite3.0.tbd
  • AdobeMobileLibrary_Watch.a
  • SystemConfiguration.framework
  • libsqlite3.0.tbd
  • AdobeMobileLibrary_TV.a

Warning: Linking more than one AdobeMobileLibrary*.a file in the same target will result in inability to build or unexpected behaviors.
  1. Confirm that your app builds without unexpected errors.

Implement Lifecycle Metrics
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ADBMobile collectLifecycleData];
    return YES;
Important: Any data passed to the SDK via collectLifecycleDataWithAdditionalData: will be persisted in NSUserDefaults by the SDK. The SDK will strip out any values in the NSDictionary parameter that are not of type NSString or NSNumber.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSMutableDictionary *contextData = [NSMutableDictionary dictionary];
[contextData setObject:@"Game" forKey:@"myapp.category"];
[ADBMobile collectLifecycleDataWithAdditionalData:contextData];
    return YES;

Information to help you implement the iOS library and collect lifecyle metrics (launches, upgrades, sessions, engaged users, and so on).
This section contains the following information:
Complete the steps in Before You Start to set up a development report suite and download a pre-populated version of the configuration file.
After unzipping the [Your_App_Name_]AdobeMobileLibrary-4.* download file, you'll have the following software components:
  1. Launch the Xcode IDE and open your app.
  2. Drag the AdobeMobileLibrary folder and drop it under your project in the Project Navigator view.
  3. Ensure that the "Copy Items if Needed" checkbox is checked, the "Create Groups" radio button is selected, and none of the boxes in "Add to Target" is selected, then click Finish.
  4. Select ADBMobileConfig.json in your Project Navigator view, and in the File Inspector view, add it to any targets in your project that will use the Adobe SDK.
  5. Click on your app in the Project Navigator view, then select your targets and link the required frameworks and libraries in the Linked Frameworks and Libraries section on the General tab.
    • iOS App Targets
    • iOS Extension Target
    • Apple Watch (watchOS 2) Target
    • Apple TV (tvOS) Target
After you enable lifecycle, each time your app is launched, a single hit is sent to measure launches, upgrades, sessions, engaged users, and many other Lifecycle Metrics.
Add a collectLifecycleData/collectLifecycleDataWithAdditionalData call in application:didFinishLaunchingWithOptions:
Including Additional Data with Lifecycle Calls
To include additional data with lifecycle metric calls, use collectLifecycleDataWithAdditionalData:
Additional context data values that are sent with collectLifecycleDataWithAdditionalData must be mapped to custom variables in Adobe Mobile services:
Other Lifecycle Metrics are collected automatically.

Thursday, December 1, 2016

iOS Push Notifications in C# with Moon-APNS

The library is called Moon-APNS and it can be downloaded from here.
This is the first version of the library, but It has been tested under pressure and on a production version of an application so feel safe to plug it to you application. Moon-APNS can be used in any .net application web or windows based.
Moon-APNS is benefiting from new Apple Push Notification structure, called Enhanced Push Notification. Which enables the library to receive feedback on each notification sent to apple server asynchronously, you may say we can receive that response with apple feedback service, but unfortunately if you send a payload to apple server with wrong format, broken or missing device tokens apple will terminate the connection straight away and it’s really hard to figure out which one was the faulty payload when you are sending them one after each other because it takes up to 2 seconds for the connection to be closed. Using Enhanced push notification you can sign each payload with a unique identifier and even better you can set TTL on each payload so apple know how long they should try to deliver the push notification before it expires. Moon-APNS will send payloads and receive feedback asynchronously and will re connect and resume sending the queue in case of any errors. All device tokens of rejected payloads will return as a list when the queue is sent and feedback is received from apple with error code sent by apple so you will know why the payload was rejected.
In Moon-APNS I’m using free and open source NLog library to log all events happening behind the scene which makes it really easy to debug the application while you are on production and you can’t attach a debugger.
Sending Apple push notification has never been so easy with Moon-APNS you will need less than 10 lines of code to send push notification and receive the feedback.
Ok enough talking I think it’s time for some coding.
1) You should generate your payloads:
1: var payload1 = new NotificationPayload("DeviceToken","Hello !",1,"default");
1: payload1.AddCustom("CustomKey", "CustomValue");
1: var notificationList = new List {payload1, payload2, payload3};
1: var push = new PushNotification(false, "P12File location","password");
1: var rejected = push.SendToApple(notificationList);
Feel free to add custom parameters to your payload as bellow:
2) Moon-APNS accepts a list of payloads, so I will add my payloads to a List:
3) create an instance of Moon-APNS push notification class, and pass true or false for using sandbox, location of your p12 file, and password for thep12 file if you have one and blank string if you don’t have one.
4) Create a list for your feedback, returned from library which will contain rejected payloads list.
5) Saved best for last call SendToApple method and pass list of your payload.
Is that all? Well yes it is! So if we ignore lines for generating payloads I can say we are sending push notification ad receiving feedback in 2 lines of code. Everything you need to do is handled by Moon-APNS library for you so you can have more time to consider on your application logic.

Tuesday, November 8, 2016

Import icons into XCode

By using Assets Catalog

  1. Extract the zip file in your desktop.
  2. Find the ios directory inside the extracted file
  3. Go to the General tab of your project settings, select the corresponding Target.
  4. In Appicon and launch images, select to use Assets catalog, open the asset catalog by clicking the arrow icon.
  5. Now drag the AppIcon.appiconset folder directly into the opened asset catalog in your XCode Project.
  6. Now you should see the icons imported. Make sure to select to use it.
  7. Clean and build your project. You should now see the icons in live!

Kasinathan Technology Blog: Checklist that would help enterprises build apps.

Kasinathan Technology Blog: Checklist that would help enterprises build apps.: The major determinants for mobile development, here is a checklist that would help enterprises build apps the right way. 1. Define Your ...

Checklist that would help enterprises build apps.

The major determinants for mobile development, here is a checklist that would help enterprises build apps the right way.

1. Define Your Business Objectives

Behind every app idea of yours, there would definitely be a purpose. While the nature of this purpose can vary depending upon its users and your business type, it is integral that you clearly define your expectations about the application. Analyzing your industry, its requirements and scope can very well help in laying out a properly defined roadmap for the development process.

2. Decide on the Platform

Several factors such as the app utility patterns, information reach, cost and security constraints are to be considered while choosing the mobile platforms such as iOS, Android, Windows or Blackberry. Your business should have a clear perspective about their target platform before they narrow down their requirement specifications further. Multiple platform development is an option that you should consider invariably if you resort to an unrestricted deployment.

3. Understand What Differences Native and HTML5 can Bring About

Now that you are a business, Native and HTML5 are two techie jargons that might bewilder you. Make sure that you understand what differences these two approaches can bring about before you move on to adopt either of the two. If you are on the lookout for an exemplary user experience and performance, Native approach can best suit your needs.
However, you need to be aware of the extra efforts that are to be put in here that can make it a bit expensive. HTML5, on the other hand, is a relatively less expensive approach which promotes the development of a mobile website. Here, multiple platform support can be enabled with the help of changes specific to each platform. Major technologies such as Sencha Touch, jQuery Mobile, jQ Touch and PhoneGap can be utilized to support cross-platform development.

4. For HTML5 Approach, Select Your Target Devices

While HTML5 allows easier deployment to multiple platforms, the differences with regard to device specifications such as screen size and resolution can be a limitation. This calls for device specific tweaks and customizations that would make the development process long. A proper selection of target devices would avoid the futile expenses and simplify the process.

5. Be Clear About the Services to be Integrated

Development companies can help you in integrating a multitude of features and services into your app. But it is vital for the enterprises to be clear enough to choose what exactly is required for their business.
If you intend your app to perform as a promotion tool, social media integration can be helpful. If your app aims to be an e-commerce platform, a payment gateway integration becomes necessary. If revenue generation is your app’s objective, various models such as in-app advertising need to be incorporated.
screen size

6. Decide on the Content that Will Go into Your App

Coding is the developer’s business and the user has nothing to do with it. It is its design and content that would appeal any average user. Have a clear idea about how your app should look like, its design and animations. Your app can be a branding tool for your enterprise and it is up to you to decide on what it should be like – right from the layout, color, content, typography, icons and screens.

7. Ensure Data Security

Depending on the nature of content that will go into your app and its sensitivity, you will have to adopt various levels of security measures. Again, this is a factor that would rely largely upon your business type and it is important to discuss this with your developer. While permitting offline data access, third party cloud packages can be used to provide additional security.

8. Consider Building Companion Websites for the App

Most of the businesses today develop companion websites to highlight the features and functionalities of the app. As this would add on more to the development cost, it is good to analyse its scope before resorting to invest on an exclusive website. In case you think a website is crucial for the branding and promotion of your app, it is recommended to depend on the same team of app developers for its development.

9. Know About the App Deployment Procedures

Once your app is ready, the deployment procedure depends on the nature of your app. If your app is intended for external customers, the application has to be submitted to the specific app-stores and each submission requires separate registration and submission fees. For internal app deployment, the enterprise should have MDM (Mobile Device Management) systems installed within their organization.

10. Take Decisions on App Support and Maintenance

Your application would require version upgrades, maintenance and other support functions from time to time depending on its type and utility. Check whether your developer can provide you with an ongoing technical support. If not, identify a third party group to support and maintain your application.
It is for sure that a mobile application can bring about major changes to the way you do business.To ensure that your app stands out from the rest, the best key is to understand the processes involved with it, analyze the possibilities and complement the development team.

Tuesday, June 7, 2016

Top 5 Android Testing Frameworks

Top 5 Android Testing Frameworks (with Examples)

Android (including iOS) developers have had unlimited access to some advanced cloud-based solution, like Testdroid Cloud, to run automated tests on a large scale of real devices for quality assurance. Also the emergence of different Android testing frameworks has substantially eased Android developers’ lives.


Undoubted, Robotium was once the most widely used Android testing framework in the early days of Android world. With a similarity with Selenium in Android, it makes testing API simpler.
Robotium is an open source library extending JUnit with plenty of useful methods for Android UI testing. It provides powerful and robust automatic black-box test cases for Android apps (native and hybrid) and web testing. With Robotium you can write function, system and acceptance test scenarios, and test applications where the source code is available.

Robotium code example:

// Public void for the operation
public void testRecorded() throws Exception {
// Wait for the text 'Hello!' to be shown for newbie
if (solo.waitForText("Hello!")) {
// R class ID identifier for 'Sign in' - and click it
// R class ID identifier for entering username
solo.enterText((EditText) solo.findViewById(""),"username");
// R class ID identifier for entering password
solo.enterText((EditText) solo.findViewById(""),"password");
// R class ID identifier for clicking log in
// Wait until log in is done
// Activate the text field to compose a tweet
// Type the tweet
solo.enterText((EditText) solo.findViewById(""), "Testdroid");
// Tweeting!
For your convenience, Testdroid Recorder is an awesome recording tool built with Robotium for test script creation. By performing actual actions on your real device, it records every step or action you take and converts to Javascript for your further modification.
In addition, you are also entitled to fully download and utilize our Extension Library – ExtSolo. It includes useful methods that have not been merged into Robotium, for instance:
  • Automatic scaling of x,y clicks for any resolution
  • Multi-path drags
  • Automatic screenshots on test failure
  • Mock locations
  • Change device language
  • Control WiFi connection


While Robotium is a good yet basic framework, uiautomator allows you to do more in testing Android apps and games. Google’s test framework allows you to test user interface (UI) of your native Android apps on one or more devices. Another advantage of uiautomator is that it runs JUnit test cases with special privileges, which means test cases can span across different processes. It also provides five different classes for developers to use, including;;;;
Similar to its time of birth, it only works on Android devices with API level 16 or higher. Another downside of uiautomator is that it doesn’t support webview, with no way to directly access Android objects.

uiautomator’s code example:

// Public void for the operation
public void testSignInAndTweet() throws Exception {
// Starting application:
getUiDevice().wakeUp(); // Press Home button to ensure we're on homescreen
getUiDevice().pressHome(); // Select 'Apps' and click button
new UiObject(new UiSelector().description("Apps")).click(); // Select 'Twitter' and click
new UiObject(new UiSelector().text("Twitter")).click(); // Locate and select 'Sign in'
UiSelector signIn = new UiSelector().text("Sign In"); // If button is available, click
UiObject signInButton = new UiObject(signIn);
if (signInButton.exists()) {; // Set the username
new UiObject(new
new UiObject(new
new UiObject(new UiSelector().className("android.widget.Button").
text("Sign In").instance(0)).click(); // Wait Sign in progress window
getUiDevice().waitForWindowUpdate(null, 2000); // Wait for main window
getUiDevice().waitForWindowUpdate(null, 30000);
new UiObject(new UiSelector().description("New tweet")).click(); // Typing text for a tweet
new UiObject(new UiSelector().className("android.widget.LinearLayout").instance(8)).
setText("Awesome #Testdroid!"); // Tweeting!
new UiObject(new UiSelector().text("Tweet")).click();


Espresso is the latest Android test automation framework that got open-sourced by Google, making it available for developers and testers to hammer out their UIs. Espresso has an API that is small, predictable, easy to learn and built on top of the Android instrumentation framework. You can quickly write concise and reliable Android UI tests with it. It is supported on API level 8 (Froyo), 10 (Gingerbread), and 15 (Ice Cream Sandwich) and afterwards.
It’s quite reliable, synchronizing with the UI thread and fast because there is no need for any sleeps (tests run on same millisecond when an app becomes idle). But it does not have support for webviews as well.

Espresso code example:

public void testEspresso() {
// Check if view with the text 'Hello.' is shown
// R class ID identifier for 'Sign in' - and click it
.getIdentifier("", null, null))).perform(click());
// R class ID identifier for entering username
.getIdentifier("", null, null))).perform((typeText("username")));
// R class ID identifier for entering password
.getIdentifier("", null, null))).perform((typeText("password")));
// R class ID identifier for clicking log in
.getIdentifier("", null, null))).perform(click());
// Activate the text field to compose a tweet
.getIdentifier("", null, null))).perform(click());
// Type the tweet
.getIdentifier("", null, null))).perform((typeText(”#Testdroid")));
// Tweeting!
.getIdentifier("", null, null))).perform(click());


Calabash is a cross-platform test automation framework for Android and iOS native and hybrid applications. Calabash’s easy-to-understand syntax enables even non-technical people to create and execute automated acceptance tests for apps on both of these mobile platforms. Calabash’s tests are described in Cucumber and then converted to Robotium or Frank in run time. It supports about 80 different natural language commands (controllers), and new controllers can be implemented in Ruby or Java.

Calabash code example:

Feature: Login feature
Scenario: As a valid user I can log into my app
I wait for text "Hello"
Then I press view with id "Sign in"
Then I enter text "username" into "login_username"
Then I enter text "password" into "login_password"
Then I wait for activity "HomeTabActivity"
Then I press view with id "menu_compose_tweet"
Then I enter text "Testdroid" into field with id "edit"
Then I press view with id "composer_post"


Appium is a mobile test automation framework (and tool) for native, hybrid and mobile-web apps for iOS and Android. It uses JSONWireProtocol internally to interact with iOS and Android apps usingSelenium’s WebDriver. It supports Android via uiautomator (API level 16 or higher) and Seledroid (API level lower than 16), iOS via UI Automation, and mobile web as Selenium driver for Android and iOS.
One of the biggest advantages of Appium is that you can write your Appium scripts on almost any programming language (e.g. Java, Objective-C, JavaScript, PHP, Ruby, Python or C#, etc), freedom from having to select tools, compatibility across the most important platforms (Android and iOS), freedom from having to install and configure devices to test and more. Also if you are familiar with Selenium, then it’s easy for you to use Appium in mobile app testing. They use the same WebDriver and DesiredCapabilities is used in the same way. Configuring an application to run on Appium has a lot of similarities to Selenium.

Appium code example:

# wait for hello
textFields = driver.find_elements_by_tag_name('textField')
assertEqual(textFields[0].get_attribute("value"), "Hello")
# click sign-in button
driver.find_elements_by_name('Sign in')[0].click()
# find the text fields again, and enter username and password
textFields = driver.find_elements_by_tag_name('textField')
# click the Login button (the first button in the view)
# sleep
# click the first button with name "Compose"
# type in the tweet message
driver.find_elements_by_tag_name('textField')[0].send_keys(”#Testdroid is awesome!")
# press the Send button
# exit