Tuesday, January 24, 2017

How to get the content of android apk file on mac

The easiest way to get the content of android apk file without any third party tools, is using unzip command line from mac's terminal app.

Just go to the folder containing the apk file from the terminal app, and run the below command
unzip androidapkfilename.apk -d targetfoldername

Android studio also has a menu item of "Build->Analyze APK...", but it cannot extract the content of APK file to local folder, so it is less useful.


Monday, January 16, 2017

Create WCF oData service on Window 10's IIS with Visual Studio 2015

To create odata service using WCF with Visual Studio 2015 on Windows 10 IIS, the first steps is following the instruction of 
https://www.codeproject.com/articles/1087982/create-a-wcf-dataservice-in-visual-studio
to create a oData WCF service. But the above link does not have a good description about how to publish the oData service to local IIS. 

To do that, following the instruction of 
https://debugmode.net/2014/06/18/publish-wcf-service-in-local-iis-on-visual-studio-2013/
The same steps also works on Visual Studio 2015.

Then for Windows 10 IIS, you will need to using the Turn Windows Feature on or off tool to turn on the below items:
1. Under Internet Information Services/World Wide Web Services\Application Development Features, turn on all items exception CGI
2.Undre .Net Framework 4.6 Advanced Services\WCF Services, turn on Http Activation item.

Then run the WCF project with the service url as below sample will get the service description
http://localhost/wcfodata/WcfDataService.svc/

Monday, January 9, 2017

How to set ios navigation view control animation direction to left/right or up/down

By default when using ios navigation view controller to manage several UIViewController using show segue, the default animation is left/right. However, in certain cases, it may make sense to change the animation direction to up/down.

It is possible to implement a custom UIStoryboardSegue to do so as mentioned in http://stackoverflow.com/questions/30763519/ios-segue-left-to-right

However, an easy way to change navigation animation direction from left/right to up/down is embedded each uiviewcontroller into its own UINavigationViewController, and you will get the up/down animation automatically. Note you will need to manually handle the back button on each UIViewController's navigation bar, so that it will unwind to the previous screen.

By the way, when using a single navigation view controller to manage several view controllers, you can only customize the navigation bar buttons title for the first view controller on storyboard, but not be able to do so for other view controllers. In order to customize the navigation bar items for other UIViewControllers from storyboard, you will need to drag and drop a navigation item (not navigation bar, as navigation bar is only for adding into UINavigationViewController) into the UIViewController from storyboard.

How cordova UIWebview passes javascript exec call into native code

When UIWebView is used, iosExec js method in cordova.js will be called by a cordova js bridge call.
The pokeNative method will be called to create an iframe element with the src of "gap://ready". When an iframe is added into the DOM tree, it will invoke the native side code in CDVUIWebViewDelegate.m method

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
Which will check whether the scheme is "gap", if so the native code will start to handle the bridge call.