I have 2 questions, regarding Sencha touch and phone gap ;
I am reading SenchaTouch CookBook by Ajith kumar. I am following the example programs given in the 1st chapter. So according to that i did the following.
THis is my index.html
<!DOCTYPE HTML>
<html>
<head>
<title>Yapps! - Your daily applications!</title>
<link rel="stylesheet" href="sencha-
touch/resources/css/sencha-touch.css" type="text/css">
<link rel="stylesheet" href="sencha-
touch/resources/css/yapps-all.css" type="text/css">
<script type="text/javascript" charset="utf-8"
src="phonegap.1.0.0.js"></script>
<script type="text/javascript" charset="utf-8" src="sencha-
touch/sencha-touch.js"></script>
<script type="text/javascript" charset="utf-8"
src="ch01/ch01_03.js"></script>
<script type="text/javascript" charset="utf-8" src="sencha-
touch/yapps-all.js"></script>
</head>
<body></body>
</html>
The ch01_03.js file. The told to add these .JS files inside the WWW folder, but i am unable to add any files inside that folder therefore i added it out of the folder.
Ext.setup({
onReady: function() {
var supportedFeatures = "Ext.supports.AudioTag : " +
(Ext.supports.AudioTag ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3BorderRadius : " +
(Ext.supports.CSS3BorderRadius ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3DTransform : " +
(Ext.supports.CSS3DTransform ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3LinearGradient : " +
(Ext.supports.CSS3LinearGradient ? "On" : "Off");
supportedFeatures += "\nExt.supports.Canvas : " +
(Ext.supports.Canvas ? "On" : "Off");
supportedFeatures += "\nExt.supports.DeviceMotion : " +
(Ext.supports.DeviceMotion ? "On" : "Off");
supportedFeatures += "\nExt.supports.Float : " +
(Ext.supports.Float ? "On" : "Off");
supportedFeatures += "\nExt.supports.GeoLocation : " +
(Ext.supports.GeoLocation ? "On" : "Off");
supportedFeatures += "\nExt.supports.History : " +
(Ext.supports.History ? "On" : "Off");
supportedFeatures += "\nExt.supports.OrientationChange : " +
(Ext.supports.OrientationChange ? "On" : "Off");
supportedFeatures += "\nExt.supports.RightMargin : " +
(Ext.supports.RightMargin ? "On" : "Off");
supportedFeatures += "\nExt.supports.SVG : " +
(Ext.supports.SVG ? "On" : "Off");
supportedFeatures += "\nExt.supports.Touch : " +
(Ext.supports.Touch ? "On" : "Off");
supportedFeatures += "\nExt.supports.Transitions : " +
(Ext.supports.Transitions ? "On" : "Off");
supportedFeatures += "\nExt.supports.TransparentColor : " +
(Ext.supports.TransparentColor ? "On" : "Off");
supportedFeatures += "\nExt.supports.VML : " +
(Ext.supports.VML ? "On" : "Off");
Ext.Msg.alert("INFO", supportedFeatures);
}
});
1.) The problem is that i am only seeing a blank screen when i run it on my iPhone and Stimulator. What is this happening, and what should i do to get the Alert displayed on the view ?
2.) I need to detect if the device i am running the application. In the book it shows how to detect an iPad, Android application and Blackberry. But not an iPhone. How can i detect an iPhone ?
Ext.setup({
onReady: function() {
if (Ext.is.Android)
Ext.Msg.alert("INFO", "Welcome Android user!");
if (Ext.is.Blackberry)
Ext.Msg.alert("INFO", "Welcome Blackberry user!");
if (Ext.is.iPad)
Ext.Msg.alert("INFO", "Welcome iPad user!");
} });
Since this question is tagged under
sencha-touch-2, I assume that you are using Sencha Touch 2.Ext.isis deprecated for Sencha Touch version 2.0Instead, you can use
Ext.env.OSpackage to detect the operating system, that is being running on the device.Also, you can use the is property to detect a p’cular device like iPad, iPhone, Android etc ..
Ext.os.is.Android: Android platformExt.os.is.iPhone: iPhoneExt.os.is.iPad: iPad etc ..EDIT :
Yes, you can detect the p’cular device. Check the below code …
Good example on Sencha Touch MVC with PhoneGap