Where to Get Help with Cordova Questions
Adding the WTP HTML and JavaScript Editors to Eclipse
Monitoring HTTP and HTTPS Requests
Customizing and Reducing the Project Size
Setting the Session Timeout for the Management Cockpit
Accelerating the Android Emulator
Proxy Settings on Android
iOS 7 Status Bar Overlays the App
Enabling Landscape Orientation
Simple Customizations
Opening URL's
Miscellaneous Tips
There is an active forum on PhoneGap/Cordova at PhoneGap Forum.
The list of known Cordova issues can be searched at Apache Cordova Issue Tracker.
The Cordova mailing lists can be searched at Apache Cordova Mailing Lists.
The Apache Cordova News section often lists bug fixes that are in a particular release.
By default the Android ADT Eclipse bundle does not contain the Web Tools editors. These can be added by choosing Help > Install New Software... > Juno > Web, XML, Java EE and OSGi Enterprise Development > JavaScript Development Tools and Web Page Editor.
After restarting Eclipse, right click on an HTML or JavaScript file and open it with the appropriate editor.
The default editor for a certain file type can be set under Window > Preferences > General > Editors > File Associations
It can be useful to examine the REST calls made between an application and the SMP 3.0 server and the SMP server and a backend. The following shows some different tools to do that although there are many others that can also be used.
TcpTrace
SMP 3.0 Server Trace
SMP 3.0 Server Trace with Fiddler
Device Trace with Fiddler
The following steps demonstrate the TcpTracewhich also shows cookies.
The SMP 3.0 server can also log all requests. There are a couple of different ways to do this.
10.7.171.196 - - [29/Apr/2014:16:58:28 -0400] "OPTIONS /odata/applications/latest/com.mycompany.timing/Connections HTTP/1.1" 200 - 146
10.7.171.196 - i826567 [29/Apr/2014:16:58:28 -0400] "POST /odata/applications/latest/com.mycompany.timing/Connections HTTP/1.1" 201 1704 453
10.7.171.196 - - [29/Apr/2014:16:58:30 -0400] "OPTIONS /com.mycompany.timing/FlightCollection HTTP/1.1" 200 - 3
10.7.171.196 - i826567 [29/Apr/2014:16:58:33 -0400] "GET /com.mycompany.timing/FlightCollection HTTP/1.1" 200 582225 3038
The second last entry indicates the response size and the last entry indicates the duration in milliseconds that the operation took. The last operation returned 569KB and took approximately 3 seconds to complete.C:\SAP\MobilePlatform3\Server\config_master\com.sap.js.logging\logging.cfg
Add the following line.system.logger.org.apache.http.wire=trace
Restart the SMP server and execute a read operation and then examine the following log file.C:\SAP\MobilePlatform3\Server\log\machine_name-smp-server.log
"GET http://services.odata.org/V2/OData/OData.svc/Products HTTP/1.1[\r][\n]"
"accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1[\r][\n]"
"maxdataserviceversion: 3.0[\r][\n]"
"accept-encoding: gzip,deflate[\r][\n]"
"accept-language: en-US[\r][\n]"
"cookie: X-SMP-SESSID=1624561118350E68CDB6424A2804FEDE0DC8430295B095C2470ED2CF7409B793; X-SMP-SESSIDSSO=DD1BE16B2AC24AA77D88FB57B3DD2458; X-SMP-APPCID=8852b007-feba-49d6-907a-3df0413d66cb; X-SUP-APPCID=8852b007-feba-49d6-907a-3df0413d66cb[\r][\n]"
"x-requested-with: com.mycompany.offline[\r][\n]" "Cookie: [\r][\n]"
"Host: services.odata.org[\r][\n]"
"Proxy-Connection: Keep-Alive[\r][\n]"
"User-Agent: Apache-HttpClient/4.2.5 (java 1.5)[\r][\n]"
"[\r][\n]" "HTTP/1.1 200 OK[\r][\n]"
"Cache-Control: no-cache[\r][\n]"
"Content-Length: 1028[\r][\n]"
"Content-Type: application/json;charset=utf-8[\r][\n]"
"Vary: Accept-Encoding[\r][\n]"
"Server: Microsoft-IIS/8.0[\r][\n]"
"DataServiceVersion: 2.0;[\r][\n]"
"X-AspNet-Version: 4.0.30319[\r][\n]"
"X-Powered-By: ASP.NET[\r][\n]"
"Date: Wed, 25 Feb 2015 19:28:02 GMT[\r][\n]"
"Proxy-Connection: Keep-Alive[\r][\n]"
"Connection: Keep-Alive[\r][\n]"
"Content-Encoding: gzip[\r][\n]"
"Set-Cookie: ARRAffinity=4a346cc2ba936a87116efc1bc94884e8ba98aac9ef2852df21b6678b3bdb51e0;Path=/;Domain=services.odata.org[\r][\n]" "[\r][\n]"
Another way to examine the requests made by the SMP server to an endpoint that has the option Use System Proxy checked is to configure the SMP Server to use Fiddler as the proxy. In this way requests made by the SMP server that go through the proxy can be examined. To see this in action run the example from the Offlinesection.
https://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT
after trying to capture the traffic with Fiddler, open certmgr.msc, and export the certificate generated by Fiddler for this endpoint.keytool -import -v -alias fiddlersapes -keystore smp_keystore.jks -storepass changeit -file c:\certs\fiddlerSapes.cer
http://ip_of_machine_with_fiddler_running:8888
The default project created by running
cordova create ...
is copied from
C:\Users\user_name\.cordova\lib\www\cordova\3.x\www
or
/Users/user_name/.cordova/lib/www/cordova/3.x/www
As such if there are files that you always wish to include in new Kapsel projects such as datajs-1.1.2.min.js they can be included here. Alternatively if you wish to not include certain files, they can be removed.
Note that in Cordova 3.4, the create command supports a --src parameter which specifies the location to get the contents for the assets folder of the newly created project. See CB-4153
Note, on iOS .folders are hidden by default. They can be made viewable by
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
The duration after which the Management Cockpit by default times out and requests the user to log in again is 20 minutes from the last use. This value can be changed by modifying the session-timeout setting in the following file and restarting the SMP 3.0 server.
C:\SAP\MobilePlatform3\Server\config_master\org.eclipse.gemini.web.tomcat\web.xml
Note that if the same browser that is hosting the Management Cockpit is also used to say invoke a REST call against the SMP 3.0 server and uses a different security profile, the Management Cockpit is logged out. An example of this is using the Chrome Advanced Rest Client to send a push notification as described in the section Push.
There are two ways that the Android emulator can be configured to run faster. The first way uses graphics acceleration to increase the redraw rate of the emulator. It can be enabled by checking Use Host GPU
Note you may run into screen redraw issues after enabling this option.
The second way is to use virtual machine acceleration. This requires the download of the Intel Hardware Accelerated Execution Manager.
It then needs to be installed.
C:\Android\adt-bundle-windows-x86_64-20130729\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe
An Android X86 based image, Intel Atom (x86) must be selected.
Note that after starting the emulator; the following message appears indicating that it is working correctly.
For additional details see Using Hardware Acceleration.
If you use a proxy server, the Android emulator can be configured under Settings > More > Mobile Networks > Access Point Names.
To set the proxy settings for an Android device that is using WIFI, go to Settings > Wireless and Network > Wi-Fi Settings > Long press on the Wi-Fi network > Check the Show Advanced Options.
A quick way to test if the proxy settings are working is to open the browser and attempt to access a web site such as http://www.google.com.
If your app runs on iOS 7 you may need to add a 20 pixel top margin so that the status bar does not overlay the main screen of the application. The Status Bar Issue describes the problem in more detail and contains the following solution.
document.addEventListener('deviceready', onDeviceReady, false);
function init() {
if (parseFloat(window.device.version) >= 7.0) {
document.body.style.marginTop = "20px";
}
}
A SAPUI5 specific solution is shown below.
html[data-sap-ui-os^="iOS7"] .sapMBar {
border-top-color:#F2F2F2;
border-top-style:solid;
border-top-width:20px;
}
Perhaps a better way to address this is to use the org.apache.cordova.statusbarplugin.
cordova plugin add org.apache.cordova.statusbar
Then modify the config.xml file and set the StatusBarOverlaysWebView to false.
If you rotate an iPhone device or simulator, the HTML page does not rotate to support the new orientation. To add this ability, in Xcode, under Info > Custom iOS Target Properties > Supported interface orientations, add the missing interface orientations such as Landscape (left home button).
On an Android device, check the following setting on 5.x devices. Settings > Display > When device is rotated > Rotate the contents of the screen.
There are a few easy ways to quickly customize your app including adding a gradient, removing the default Cordova splash screen and changing the app icon. Additional information on app icons and splashscreens can be seen at Splashscreen.
<head>
<style>
body {background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#feffff), color-stop(35%,#ddf1f9), color-stop(100%,#a0d8ef));}
</style>
project_name\platforms\android\res\drawable-xxxx.
Note that cleaning the project may be necessary after changing the icon or splash screen.
To open an external URL from index.html, the Cordova InAppBrowser plugin can be used.
<script>
function showURL(url) {
var URLToOpen = encodeURI(url); //may be needed if URL contains parameters
var ref = window.open(URLToOpen, '_blank', 'location=yes,toolbar=yes,toolbarposition=top'); //toolbar options are iOS only
//Note on Android, some attachment types such as PDF, XLS, DOCX can be opened by changing '_blank' to '_system'
//The appropriate viewer would need to be installed and it may help to have a file manager program like ES File Explorer installed
}
</script>
<a href="javascript:void(0);" onclick="showURL('http://www.google.com')">www.google.com</a>
This will open a new window showing the web site www.google.com. ; When the window is closed, the Kapsel app will regain focus.
Note that local HTML files can simply be opened using
<a href="accounts.html">Open Accounts</a>
Note that on Android, if the resource does not exist and the link is clicked on the app will close. To instead shown an error screen, modify the config.xml file under the res/xml folder to include a preference setting indicating an error page to open.
<preference name="errorUrl" value="file:///android_asset/www/error.html" />
See Android Configuration for additional details.
public class LogonDemo extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.setIntegerProperty("loadUrlTimeoutValue", 60000); //add this line.
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html")
}
}
See also Android Configuration.netstat -ano | findstr 8083
TCP [::]:8083 [::]:0 LISTENING 8092
Using the above information we can see that a process with the process ID of 8092 is using port 8083. Open the task manager on windows and add the PID column and check Show processes from all users to find the process that is using port 8083. The SMP 3.0 server should appear as a java.exe process and a description of SAP Java VM Runtime binary.Started backup to iCloud! Please be careful.
Your application be might rejected by Apple if you store too much data.
This setting is controlled by the preference setting BackupWebStorage which is set by default to cloud in the config.xml file.nohup android &
the terminal window can be closed and then the Android SDK Manager menu appears.adb shell input text some_text_to_enter
Back to Getting Started With Kapsel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
32 | |
24 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |