Thursday, December 31, 2015

iOS Hotspot Network SubSystem



The hotspot network subsystem allows a hotspot helper application to participate in the process of classifying and authenticating to Wi-Fi hotspots. A hotspot helper application can receive commands and provides a responses to a command once it has been processed. In most instances application command processing occurs while application is running in the background. 

The application receives command to process as part of two main functions: authentication and scan list filtering. 

References:


iOS Search API Best Practices



There are two categories of content. 

1. Private : Directly indexed using NSUserActivity and CoreSpotLight APIs. App can index content that user has created locally and this content remains in the user’s device and is searchable only locally. 

2. Public : Content that comes from the website. Apple uess a web crawler, called Applebot, to gather publicly available information that has been marked up using standard web markup techniques. This info is then presented to users when they use Search in iOS 9.0 or from Safari Suggestions. 

Which is the Right API to use? 

NSUserActivity : New methods and properties in the NSUserActivity class help one to index items from the app as the user does an activity in the app. This could include creating or visiting a piece of content, viewing a set of items such as visiting a navigation point. As the users do these activities in the app, the NSUSErActivity API can be used to indxed such actions. For e.g. Health app can add activities that let users search for “Steps” and be taken directly to that pane in the health app. 

Core Spotlight: The framework enables indexing of app content that is searchable privately on a persons device. One can add. delete , update and delete items in core spotlight index and that info will be searchable for easy access. Using a search extension, we can add content in the background even if app is not running. This allows the index to be up to date as the content changes even if the user activity isn’t actively using the app. This is for great things like messaging and conversations stored on the server but accessed through the app or locally generated content 

Web Markup: This is useful for apps that has mirrored content on the web. Applebot crawls the website and show its content on search results. By Implementing web markup we can make results look richer, increase engagement and seamless redirect users to specific content in the app. 

References:

A Few GIMP Tips



Bucket Fill Transparency

http://hamwaves.com/gimp.transparency/en/

Adding transparency to an Image

Below Steps can be followed for this:

- Open the Image with GIMP
- Windows -> Dockable Dialogs -> Layers
- Adjust the opacity here to slightly adjust the transparency (85% etc)

Another a large number of tutorials available here:



Chromcast How to Cast from a device



For Casting from a Youtube app, the steps are easy as below 

1. Download the latest youtube app on the phone (Android, iOS)
2. Connect the device to the same WiFi as the chrome cast 
3. Open the Youtube app on the device and press the Cast button 



references:

What is SIP MSRP (Message Session Relay Protocol)

MSRP is a text based connection oriented protocol for exchanging arbitrary MIME content, especially instant messages. 
MSRP sessions are typically arranged the same way a session of audio or video media is set up. One UA sends another UA invitation containing an offered session description that includes a session of MSRP. 


References: 


Crash reporting in iOS programmatically




The concept is useful to get some level of information after a crash, however, the stormy environment that exist soon after the crash occurs is not easy to capture all the details. Some of the framework such as Crittercism which uses the PLCrashreporter , https://www.plcrashreporter.org/ and other sites such as KSCrashReporter are very useful to get the details of crash that happens. 

https://github.com/kstenerud/KSCrash

References

iOS ABAddressbook concepts a few notes

Properties: There are two kind of properties single value and multi value. Multi value properties contains data that can have multiple values. 
Multi value properties can either be mutable or unmutable. 

Following is example to get the single value property 

ABRecordRef personRef = ABPersonCreate();
CFErrorRef anError = NULL;
bool didSet;

didSet = ABRecordSetValue(aRecord,kABPersonFirstNameProperty,CFSTR(“Katie”), &anErr);
CFStringRef firstName = ABRecordCopyValue(aRecord,kABPersonFirstNameProperty);
CFRelease(firstName); 

Multi Value Properties 

MultiValue properties consist of list of values. Each value has a text label and an identifier associated with it. There can be more than one value with the same label, but the identifier is always unique. There are constants defined for some commonly used text labels. For e.g. Phone number of a person can be many. 


REferences:


https://developer.apple.com/library/prerelease/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/BasicObjects.html#//apple_ref/doc/uid/TP40007744-CH3-SW1

List of available trust certificates in iOS

the iOS trust store contains trusted root certificates that are pre-installed with iOS

About trust and trust certificates 

Each iOs trust store listed below contains three categories of certificates. 

Trusted certificates establish a chain of trust that verifies other certificates signed by the trusted roots. for e.g. establish a secure connection to a web server. When IT administrator create configuration profiles for iOs, these trusted root certificates need not be included. 

Always ask certificates are untrusted but not blocked. When one of these certificates is used, one will be prompted to choose whether or not to trust it.

Blocked certificates are believed to be compromised and will never be trusted. 


References:
https://support.apple.com/en-in/HT204132

RTCP some detailes



the RTCP packet contains below items 

8 bytes of UDP header 
12 bytes min of RTCP header
Variable, with 32 bit boundary of of RTCP data 

RTCP is delivered over RTP UDP port number + 1
(usually one port number per multi media session) 

Usually, RTCP packets are bundled and may contains several packets which is encapsulated in the same UDP data gram (to reduce the overhead due to headers) 

The RTCP header has the following components

version - 2 bits
Padding bit - 1 bits 
RR count - 5 bits
Packet Type - 8 bits 
Message Length - 16 bits 

The following are the possible packet types possible in the RTCP data 

192 - FIR => Full INTRA frame request 
193 - NACK => Negetive Acknowledgement 
200 - SR => Sender report for transmission and reception statistics from active senders (periodically transmitted) 
201 - RR => Receiver report for reception statistics from participants that are not active senders (periodically transmitted) 
202 - SDES => Source Description items (including CNAME - canonical name) 
203 - BYE => Good bye indicates end of participation 
204 - APP => Application specific functions 
207 - XR => RTCP extension 

References:

A Few Notes on MQTT



MQTT decouples SUBSCRIBERS for PUBLISHERS 

- Anyone can PUBLISH and any one can SUBSCRIBE to the data. As long as the data is in the understandable format, the exchange will be smooth. 

MQTT allows wildcard subscriptions 

Some of the Published data can be as below 

scores/football/big12/Texas
scores/football/big12/TexasTech
scores/football/big12/Okalahoma
scores/football/big12/IowaState

Everyone of the above will PUBLISH to the MQTT broker. 

The interested parties and their SUBSCRIPTION can be below 

Texas Fan => scores/football/big12/Texas
Big12 Fan => scores/football/big12/+
ESPN => scores/#

+ represents single level wild card
# represents multi level wild card 

Some of the network properties of MQTT are: 

Small Packet Size: 
PUBLISH is 2-4 bytes
CONNECT is 14 bytes 
HTTP is 0.1 - 1 KB

the headers is binary payload and it is not text 
Small clients that has 30KB foot print and as well as huge memory foot print clients can be well supported at the same time 

Minimal protocol exchanges between ends. MQTT has a configurable keep alive 2 byte PINGREQ/PINGRES

MQTT supports QoS for reliable messaging:
There are 3 QoS levels 
1. QoS 0: at most once  (PUBLISH) 
- Doesn’t survive failure
- Doesn’t repeat 

2. QoS 1: At least once (PUBLISH, PUBLIC ACK) 
Survives connection loss
can be duplicated 
3. QoS 2 : exactly once (PUBLISH, PUBREC, PUBREL, PUBCOMP)
Service connection loss,
Never duplicated 



References:

Configuration Profiles - Purpose, Categories, Types, Structure and Payload overview



Purpose: 

configuration profiles and installation of them allows an organization to streamline the process of deploying and managing large number of computers. Below are the few types of settings, we can inlcude as part of the configuration profile. 

- Passcode and Security policies
- Network settings including WiFi, VPN, 802.1x 
- Account settings including LDAP, calendar, and instant messaging
- Credentials and Keys
- Login items 
- Dock preferences
- gatekeeper settings 
- PArental controls 
- Custom settings with key - value pairs for specific prefernce domains

Categories:

Below are the two categories of profiles that can be installed on OS X computer.

User Profiles: Contains settings for individual users or user groups such as passwords, parental controls 
Device Profils : which contains settings for individual devices or device groups, such as directory bindings, energy saver, and restrictions 
In OS X, a profile created for a device or device group is applied at the System level, while the profile created for a user or user group is at the user level. 

Types:
There are three types of profiles

1. Configuration Profiles 
2. Managed Profiles 
3. Trust Profiles 



References:

Android Google Cast App Development



Typical Sender app flow is 

1. Sender app starts MediaRouter device discovery.  MediaRouter.addCallback 
2. MediaRouter informs the sender app of the route that user has selected MediaRouter.Callback.onRouteSelected
3. Sender app retrieves CastDevice instance CastDevice.getFromBundle 
4. Sender app creates a GoogleApiClient GoogleApiClient.Connect
5. SDK confirms that GoogleApiClient is connected GoogleApiClient.ConnectionCallbacks.onConnected 
6. Sender App launches the receiver app Caster.castApi.launchApplication
7. SDK confirms that the receiver is connected ResultCallback 
8. Sender app creates a communication channel Cast.CastApi.sendMessageReceivedCallbacks 
9. Sender sends the message to the receiver over the communication channel. Cast.CastApi.sendMessage 

References:

What is Google Chromcast


Chromcast is a thumb sized media streaming device that plugs into the HDMI port on TV. Simply use an Android phone, tablet, iPhone  iPad , Mac , Windows laptop or chromebook to cast favorite entertainment and apps right to the big screen. 

Chrome cast works with a great number of apps. Such as Youtube, YuppTV, Google Play, Erose Now, Spuul etc. For everything else, we can mirror what we see on small screen to the big screen. With chromcast, the phone becomes the personalized remote control. 

When the casting is not perfomed, the TV screen becomes a beatiful backdrop filled with images one can customize. There seems to be also a guest mode. guests don’t need to connect to the home wifi, 

The chromcast device can be plugged into any HDTV, then connect with the WiFi , and cast from the device.  

References

Android TV and Chromcast

Chromcast is basically gateway to content. One cannot install anything to it and neither cannot control anything on it without another device. and cannot even set it up without a browser or an Android app. 

Google TV is full blown Android device, it has access to official Google play store and can install applications and games rent or buy movies to play directly n the TV through the device listen to the Google play. This also comes with a remote and lets to control the device using this remote. 

References:

Android TV - A quick look



Android TV delivers world of content on to the living room. 

From user experience perspective, apps such as YouTube, Netflix, and BBC iPlayer put personalized recommendations for videos, shows and sports on the homescreen 

A user can press on Mic on Android TV what is wanted. It could be “Jurassic Park”, “whats tomorrows weather forecast”

There is a cast feature which allows to cast movies and TV Shows music, games, sports and more - and this can be done from Android, iOS, Mac, Windows or Chromebook to the TV. 
Just tap on the cast button on the mobile app to start playing on TV. 

There are two options for user. Android TV built in or by connecting Android TV device to existing TV set. 

References:

Apple tvOS - A quick look

tvOS 



Its an innovative TV platform that redefines what can be done in the living room. Users can now deliver good apps and games on the big screen using the tvOS SDK. 

This allows to create experiences that connect to and immerse users even when the screen is across the room. We can take advantage of powerful GPU, CPU capabilities of the 1080p display and the new TV remote features a touch surface built in accelerometer and gyroscope. 

When developing with tvOS, we can take advantage of many of the same frameworks such as Metal, cloudKit, UIKit, and Game center to create rich games and apps that look amazing on Apple TV. 

New templates using XML and Javascript are also available as a framework for tvOS apps so that developer can use predefined layouts and Javascript APIs to quickly create beatiful apps ideal for streaming media. 

references:

Tuesday, December 29, 2015

Java PNS quirks

While trying to run the NotificationManager class, it seemed to give the exception like below

C:\server>java -cp . NotificationManager test
_server_push_cert2.p12 pass123 f5e10e727d3252b2b793740f2a940ac027f41761cee37b
99f2ec836ae7ed7d89 production
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONExceptio
n
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more


It actually went away once gave the classpaths properly like below. 

C:\server>java -cp .;JavaPNS_2.2.jar;log4j-1
.2.17.jar;bcprov-jdk15-146.jar NotificationManager cca_server_push_cert2.p12 pass123 f5e10e727d3252b2b793740f2a940ac027f41761cee37b99f2ec836ae7ed7d89 product
ion
---- Notification test starts ---
log4j:WARN No appenders could be found for logger (javapns.notification.Payload)
.
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in

fo.

Thursday, December 24, 2015

Android bringing Activity to foreground

To bring activity to the foreground, Below simple code can be done. 

Intent notificationIntent = new Intent(this, MainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
try
{
    pendingIntent.send();
}
catch (CanceledException e)
{
    e.printStackTrace();

}

References:
http://stackoverflow.com/questions/12074980/bring-application-to-front-after-user-clicks-on-home-button

Saturday, December 19, 2015

iOS 9.0 Search Using NSUserActivity

The concept is simple, below code helps app to be listed in the spot light search



References:
http://code.tutsplus.com/tutorials/ios-9-introducing-search-apis--cms-24375

Tuesday, December 8, 2015

Android Error because of library files are in application path + module path

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
  /Users/retheesh.r/Library/Android/sdk/build-tools/21.1.2/dx --dex --no-optimize --output /Users/retheesh.r/Desktop/RR/per/Projects/EyeOMe/app/build/intermediates/dex/debug --input-list=/Users/retheesh.r/Desktop/RR/per/Projects/EyeOMe/app/build/intermediates/tmp/dex/debug/inputList.txt
  Error Code:
  2
  Output:
  UNEXPECTED TOP-LEVEL EXCEPTION:
  com.android.dex.DexException: Multiple dex files define Lde/mindpipe/android/logging/log4j/LogCatAppender;
  at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
  at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
  at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
  at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
  at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
  at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
  at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
  at com.android.dx.command.dexer.Main.run(Main.java:246)
  at com.android.dx.command.dexer.Main.main(Main.java:215)
  at com.android.dx.command.Main.main(Main.java:106)


This issue was because the Log4J jar file was included in the app jar directory and as well inside the module lib folder.