The87Boy
The87Boy

Reputation: 887

Use Sencha Touch camera - app will not open but keeps loading

I have tried to create a simple app for Android using Sencha Touch, where app.js looks like this

Ext.application({
   name: 'CameraApp2',

   requires: [
      'Ext.device.Camera'
   ],

   views: [
      'Main'
   ],

   launch: function() {
      Ext.Viewport.add(Ext.create('CameraApp2.view.Main'));
   }
});

And main.js look like

Ext.define('CameraApp2.view.MyPanel', {
   extend: 'Ext.Panel',

   requires: [
      'Ext.Button',
      'Ext.Img'
   ],

   config: {
      items: [
         {
            xtype: 'button',
            handler: function(button, e) {
               Ext.device.Camera.capture({
                  source: 'camera',
                  destination: 'file',
                  success: function(url) {
                     var img = Ext.getCmp("Image");
                     img.setSrc(url);
                  }
               });
            },
            text: 'Take photo'
         },
         {
            xtype: 'image',
            id: 'Image',
         }
      ]
   }
});

The config.xml looks like

<?xml version='1.0' encoding='utf-8'?>
<widget id="<company>.cameraapp2" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
   <name>CameraApp2</name>
   <description>A simple demo app to show camera-pictures</description>
   <author email="[email protected]" href="http://cordova.io">
      the87boy
   </author>
   <content src="index.html" />
   <feature name="Camera" />    
   <access origin="*" />
</widget>

I added <feature name="Camera"> to be sure, it was not the problem. Of course I have replaced the company by <company-name>.

The problem is, that the app will not start and just keeps loading, but it shows fine on the webpage.

I tried to add a loader in app.js but it did not work either

I also tried to add the plugin for Cordova using cordova plugin add org.apache.cordova.camera.

What can be wrong?

I am using Sencha CMD version 5.0.1.231, Sencha Touch version 2.4.0, Cordova 3.5.0 and Android 4 on Samsung Galaxy Tab S

EDIT

I have also tried with another app (without device interaction) on the Samsung Galaxy Tab S, and it works

Upvotes: 0

Views: 465

Answers (1)

tabrindle
tabrindle

Reputation: 1874

It's hard to tell if this is a Sencha build issue from the code, which seems fine. Sometimes, depending on your build process, Sencha's built in minification and concatenation and mess things up and cause JavaScript errors if you are using sencha app build package or production. If you are using the build native command, I believe this does the same thing.

Chrome has a nifty debugging feature just for this type of issue. You should be able to remotely inspect the app and debug using the console with chrome's remote device inspection.

ADB and appropriate drivers may be required.

chrome://inspect/#devices

Here is a useful resource.

https://developer.chrome.com/devtools/docs/remote-debugging

Of note, if you signed the app with release keys for android, this will not work. It must be a debug apk.

Upvotes: 1

Related Questions