I am initializing cordova in my app which was using touch2.3 and added barcodescanner.js file in app.json and build it successfully using sencha app build native.I loaded .apk file in my android and trying to run,when I hit scanner button it is raising an alert saying cordova/plugin/BarcodeScanner not found.I updated config.xml . How to add custom cordova plugins to new Sencha tocuh2.3?.Please help me on where I was going wrong.Any help would be appreciated.Thank you
Download the repo using GIT or just a ZIP from Github.
Add the plugin to your project (from the root of your project):
go to your cordova or phonegap folder run follwing cmd
cordova plugin add
then run beloows for check
cordova plugin ls
I tried following these instructions without success and let me be more specific:
created sencha 2.3 app called myscan
added Cordova (not Phonegap) with Sencha cordova init
cd to Cordova folder
added the plugin
cordova plugin add https://github.com/wildabeast/BarcodeScanner
5 build the app with sencha app build native
6 created a simple test
Ext.device.Scanner.scan(function(c) {
alert("We got a barcode\nResult: " + c.text + "\nFormat: " + c.format + "\nCancelled: " + c.cancelled)
}, function(c) {
alert("Scanning failed: " + c)
})
I was not surprised to see that Ext.device was not defined as all the example code I could find use the navigator object so I looked at the WildaBeast sample code and changed the call to
Cordova.plugins.barcodeScanner.scan ... Now everything is defined and I trace into the code and seems to make the call into IOS but nothing meaningful results and no callbacks are called.
Now Gigi are you using Sencha Cmd v4.0.1.45
after installed barcode scanner plugin use sencha plugin Ext.ux.mgd.device.Scanner
Related
I am using sencha sdk tool 2 to build my extjs 4 application. Build is working fine and it generated two files -
app-all.js - minified
all-classes.js - non-minified
But when I am using minified app-all.js with ext.js in my index-mini.html page it is not working and giving me the error "Cannot read property 'get' of undefined" at Ext.util.Cookies.get()
My application is working fine when I am using ext-all.js instead of ext.js.
I saw that my application is using some util classes(like - Ext.util.Cookies) that are not present in ext.js. Also for development we are using ext-all.js in our index.html but for deployment we want to use ext.js.
Questions -
How can I run my application using ext.js & app-all.js?
-
Thanks in advance.
The problem is that ext-all.js (and the un-minified ext-debug.js) only provide the minimum number of core ExtJS classes needed to get up and running. Any additional classes should be dynamically loaded as separate files
Section 2.2 of Getting Started describes this, and also explains that you should dynamically load any additional classes.
Basically, you need to include a requires statement in your application as shown below.
requires:[
'Ext.util.Cookies'
],
I am new to Sencha Touch and Sencha Command. I downloaded the requisite tools to build a Sencha Touch app. When I use the following command in Sencha Command, the app is generated fine but when I try to access it using the browser I see only the loader.
sencha -sdk touch-2.3.1 generate app MyApp ./MyApp
When viewed on Firefox, it shows following errors in the console.
TypeError: Ext.Loader is undefined bootstrap.js: 7
TypeError: Ext.application is not a function app.js: 50
On some investigation, I found that it is looking for the above mentioned files in a directory named touch directly under http://localhost/. Whereas I have Sencha framework and my app under http://localhost/sencha/touch-2.3.1 and http://localhost/sencha/MyApp.
Some files under MyApp directory have the path mentioned to touch directory as ../../../../touch. If I copy the framework in http://localhost/touch it works fine.
Why should this happen? Shouldn't my app refer to http://localhost/sencha/touch-2.3.1 folder for dependencies?
I am using the default configuration to build a default application. Can someone guide me what I might be doing wrong?
Sencha Cmd assumes that your app runs at the root of the web server... so if you're running it from a subfolder, you might see problems like this.
You can set the correct paths manually to your resources in app.js
//at the very top, before Ext.appliction()
Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext' : '../touch',
'My' : 'app' //or wherever
}
});
I think that should solve your problem, if I understand it correctly.
i use flow command :
sencha -sdk D:\dev\ext\ext-4.2.1.883 generate app -t ext-theme-neptune msg .\
then i check the /.sencha/app/sencha.cfg file, the app.theme still like this app.theme=ext-theme-classic,
and the bootstrap.css still is #import 'ext/packages/ext-theme-classic/build/resources/ext-theme-classic-all.css'.
how could i change the app theme by using sencha cmd?
I haven't tried generating an app which includes specifying a theme. Anyway, you can always change the theme of your app by editing the app.theme=ext-theme-classic to app.theme=ext-theme-neptune found on your project directory .sencha/app/sencha.cfg
then, execute
sencha app refresh
maybe it will help smbd. For ExtJs 5 you only have to
1) change in app.json:
"theme": "ext-theme-crisp-touch"
2) cmd:
sencha app build
I have a workspace project that includes an ExtJS app, Touch app, and a set of files that are shared between the two projects set up like this
WorkspaceFolder
ExtJSAppFolder
TouchAppFolder
SharedCodeFolder
I have the SharedCodeFolder referenced in the bootstrap loader and the ExtJS/Touch applications load in the browser fine
bootstrap.js
Ext.Loader.addClassPathMappings({
"ExtJSApp": "app",
"Ext": "../ext/src",
"Ext.rtl.EventObjectImpl": "../ext/src/rtl/EventObject.js",
'SharedCode': '../SharedCodeFolder/'
});
but when I try to use Sencha Cmd to build, it's giving me this error
[ERR] failed to find meta class definition for name
ExtJSApp.store.SharedCode.store.StoreFile
How do I tell Sencha Cmd to not append the ExtJS app namespace to the name of the SharedCode file? It should be looking for
SharedCode.store.StoreFile
not
ExtJSApp.store.SharedCode.store.StoreFile
You can add the SharedCodeFolder path to your workspace.classpath in the WorkspaceFolder/.sencha/workspace/sencha.cfg file:
workspace.classpath=${workspace.dir}/SharedCodeFolder
See here for more info:
http://docs.sencha.com/ext-js/4-2/#!/guide/command_workspace-section-7
When i try to package my application natively for IOS in Sencha Touch 2.1 it gives me this error:
Sencha Cmd v3.0.0.250
[ERR]
!AMDeviceSecureInstallApplication
The application was successfully packaged
The application was successfuly signed
[ERR] stbuild exited with non-zero code : 1
It's not working with Xcode please any help will be appreciated.
This is my packager.json
{
"applicationName":"Demoedifarm",
"applicationId":"com.palapa.demoedifarm",
"bundleSeedId":"S5583Y6VFB",
"versionString":"1.0",
//"versionCode":"1",
"icon": {
"57":"resources/icons/Icon.png",
"72":"resources/icons/Icon~ipad.png",
"114":"resources/icons/Icon#2x.png",
"144":"resources/icons/Icon~ipad#2x.png"
},
"inputPath":"./",
"outputPath":"../build/",
"configuration":"Debug",
"platform":"iOS",
"deviceType":"iPad",
"certificateAlias":"iPhone Developer",
//"certificatePassword":"",
"provisionProfile":"/Users/palapa1/Library/MobileDevice/Provisioning Profiles/CA412FD2-60D6-407E-B7AD-A34637A8FF55.mobileprovision",
//"sdkPath":"/path/to/android-sdk",
//"sdkPath":"/path/to/android-sdk",
//"androidAPILevel":"8",
/*"permissions":[
"INTERNET",
"ACCESS_NETWORK_STATE",
"CAMERA",
"VIBRATE",
"ACCESS_FINE_LOCATION",
"ACCESS_COARSE_LOCATION",
"CALL_PHONE"],*/
"minOSVersion": "4.2.1",
"orientations": [
"landscapeLeft",
"landscapeRight"
]
}
I'm running a more recent version of Sencha Cmd (3.1), and I believe the command syntax has changed slightly, but I hit this same error so I figured I'd put an answer out just in case it helps someone.
If I run the following command:
sencha app package run myConfigFile.json
Then it fails with the same error, and I don't know what the problem is. However if I change the config file so it is targeting the iOS Simulator (the 'platform' property) then it works fine (the simulator opens automatically).
If I run this command instead:
sencha app package build myConfigFile.json
Then it completes successfully, and I end up with a MyApp.app file in the output folder.
If I have the XCode Organizer window open, I can then drag this file onto the 'Applications' folder underneath my attached phone and it will deploy/install the app for me.
If you use a provisioning profile you need to set
"configuration":"Release"
instead of Debug in packager.json. That's a bug in the docs.
Also, see this post for a good tutorial: http://frightanic.com/software-development/sencha-touch-native-packaging-for-ios-done-right/