Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all 8068 articles
Browse latest View live

Image rounding while image view height and with in Ti.UI.SIZE.

$
0
0

I am beginner in titanium. May be its a simple question. can you please help me on this.
Is this possible to round an image in titanium which have not set any fixed height and width?
i just want to round image which have set height and width property as "Ti.UI.SIZE".
<ImageView height="Ti.UI.SIZE" width="Ti.UI.SIZE" image="/images/test.png" ></ImageView>


Opening local file in media player with android intent

$
0
0

Hi Everyone,

Can someone help me with opening local file in media player with android intent.

See my code below i have tried lots of different combinations with no luck yet.

Ti.API.xml

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
             <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <data android:type="audio/*" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <application android:theme="@style/Theme.Aheme"/>
            <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>
        </manifest>
    </android>
var intent = Ti.Android.createIntent({
            action : Ti.Android.ACTION_VIEW,
            type : "audio/*",
            url : model.url.nativePath
        });
        //intent.putExtraUri(Titanium.Android.EXTRA_STREAM, model.url.nativePath);
        intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
        //Titanium.Android.currentActivity.startActivity(Titanium.Android.createIntentChooser(intent, 'Play Audio With'));
        Ti.Android.currentActivity.startActivity(intent);

jobTitle property in Ti.Contact.createPerson not working on Android

$
0
0

When i create a contact via Ti.Contact.createPerson the field isn't added on Android, on iOS it works fine.

Found an ticket on the Jira saying that the organization and jobTitle were linked in a object on Android instead of just plain strings and that they documentation should be updated, the ticked is closed but documentation still says that both the orginazation and jobTitle properties should be entered as Strings.

Link to the Jira ticket: https://jira.appcelerator.org/browse/TIDOC-64

Youtube Video stopped playing after TItanium studio update to 3.4

$
0
0

Hi, I am working on android and iOS app on titanium build using titanium classic project. Everything was working fine in the application build using titanium studio version 3.3. After updating the version to 3.4.1 the youtube video on the webview has stopped playing.

Titanium Studio, build: 3.4.1.201410281727 Titanium Studio, SDK: 3.4.1.GA

Following is the detailed log message I am getting in console-

I/TiWebChromeClient.console: (main) [99,10993] The key "target-densitydpi" is not supported. (39:file:///android_asset/Resources/)
 
[INFO] :   I/TiWebChromeClient.console: (main) [20979,31972] XMLHttpRequest cannot load chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js. Cross origin requests are only supported for HTTP. (0:http://www.youtube.com/embed/8W_sr4mW620)
 
[ERROR] :  OMXMaster: A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
[INFO] :   VideoCapabilities: Unsupported profile 4 for video/mp4v-es
[INFO] :   SoftAAC2: Reconfiguring decoder: 0->44100 Hz, 0->2 channels
[INFO] :   OMXClient: Using client-side OMX mux.
[ERROR] :  ACodec: [OMX.qcom.video.decoder.avc] storeMetaDataInBuffers failed w/ err -2147483648
[WARN] :   ACodec: do not know color format 0x7fa30c03 = 2141391875
[ERROR] :  ACodec: registering GraphicBuffer 0 with OMX IL component failed: -2147483648
[ERROR] :  ACodec: Failed to allocate buffers after transitioning to IDLE state (error 0x80000000)
[ERROR] :  ACodec: signalError(omxError 0x80001001, internalError -2147483648)
[ERROR] :  MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 5
[ERROR] :  MediaCodecBridge: Cannot start the media codec
[ERROR] :  MediaCodecBridge: android.media.MediaCodec$CodecException: start failed
[ERROR] :  MediaCodecBridge:    at android.media.MediaCodec.native_start(Native Method)
[ERROR] :  MediaCodecBridge:    at android.media.MediaCodec.start(MediaCodec.java:612)
[ERROR] :  MediaCodecBridge:    at com.android.org.chromium.media.MediaCodecBridge.start(MediaCodecBridge.java:274)
[ERROR] :  MediaCodecBridge:    at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
[ERROR] :  MediaCodecBridge:    at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28)
[ERROR] :  MediaCodecBridge:    at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] :  MediaCodecBridge:    at android.os.Looper.loop(Looper.java:135)
[ERROR] :  MediaCodecBridge:    at android.app.ActivityThread.main(ActivityThread.java:5221)
[ERROR] :  MediaCodecBridge:    at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  MediaCodecBridge:    at java.lang.reflect.Method.invoke(Method.java:372)
[ERROR] :  MediaCodecBridge:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[ERROR] :  MediaCodecBridge:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Any help would be appreciated. Regards, Fenil

Web Service with x.509 Certificate Authentication under iOS 8?

$
0
0

Greetings,

We have an app that connects to a web service. This connection is using https (SSL), and also uses client & server certificates for authentication.

Under iOS 7, we used a cryptoLibrary module (SealSign CryptoLibrary, third-party) that managed this for us well. No issues running under iOS 7.

Under iOS 8, however, we're having problems. Specifically, the server certificate is only parsed correctly the first time a web service call is initiated. Subsequent web service calls fail to parse the server certificate correctly. The crypto library was supposedly updated for iOS 8, but the developers indicate that the issue is with iOS, specifically onLoad events not firing correctly.

Is anyone using secure web services with 509 certificates under iOS 8 successfully? If so, how are you managing the certificates (i.e., module, etc.)? There seems to be nothing within the Titanium SDK for this, which is extremely odd and disappointing.

Any help would be greatly appreciated. We're in a huge time crunch on this.

work sqlite titanium

$
0
0

hello

I'm trying to optimize the database in my app and work to better feeding tables, leaving my code so they can see if it is a good way to work feeding the database and where I can include this file must start at entry to the app.

module.exports = function(obj) {
    var db = Ti.Database.open('elite'),
        _ = require("/lib/underscore");
 
 
    db.execute('CREATE TABLE IF NOT EXISTS USUARIOS (id INTEGER PRIMARY KEY, user TEXT, pass TEXT)');
    db.close();
    /*FUNCION PARA INSERTAR REGISTROS EN LA BASE DE DATOS*/
    var insertData = function(args) {
 
        var client = Ti.Network.createHTTPClient({
             onload : function(e) {
                 var db = Ti.Database.open('elite');
                 db.execute('BEGIN IMMEDIATE TRANSACTION');
                 db.execute('DELETE FROM '+args.table);
                 var data = JSON.parse(this.responseText);
 
                 _.each(data, function(value) {
                    //Ti.API.info(JSON.stringify(value));
                    //var datos = JSON.stringify(value);
                    //db.execute(args.sql(datos));
                    Ti.API.info(args.sql(value));
                 });
                 db.execute('COMMIT TRANSACTION');
                 db.close();
 
             },
 
             onerror : function(e) {
                 Ti.API.error(e.error); 
             },
 
             timeout : 5000  
         });
 
         client.open("GET", args.url);
         client.send();
 
    };
    /***FINALIZAMOS FUNCION**/
    new insertData({
        url:'http://agrosuper.checkrocket.com/include/api/json/user.php',
        table:'USUARIOS',
        //sql:'INSERT INTO USUARIOS VALUES ('+this+',"'+this.name+'","'+this.password+'")',
        sql: function(e) {
            var datos = JSON.stringify(e);
            var consulta = datos['name'];
            return consulta;
        }
    });
 
 
 
};

Titanium throws FileNotFoundException when i run an app project with android module

$
0
0

The studio shows the information : failed to compile Java source files; according to the build.xml the bootstrap.py should produce [Name]Bootstrap.java, [Name]Bootstrap.cpp,bootstrap.js and KrollGeneratedBindings.gperf,but it does not work,the [Name]Bootstrap.java, [Name]Bootstrap.cpp,bootstrap.js and KrollGeneratedBindings.gperf does not exist.

http request issue

$
0
0

i have the following code that makes my app crash when is event onload or even onerror

var serverRequest  = Ti.Network.createHTTPClient({
            timeout:2000,
            cache:false,
            onerror :function(e){
                popupLoader.hide();
                var quoteTools =  new Quote();
                var json = this.responseText;
                var response = JSON.parse(json);
                var dataServer = response.message;
                quoteTools.changeStatus('COTI_ENVIADO',0);//mark quote as not send
                popupLoader.close();
                var message = L('errorSendingQuote');
                quote.sentQuote(message,false);
            },
            onload : function(e){
                popupLoader.hide();
                var json = this.responseText;
                var response = JSON.parse(json);
                var flag = false;
                var message = '';
                var quoteTools =  new Quote();
                var dataServer = response.message;
                if(dataServer.status == 0){//error from server
                    quoteTools.changeStatus('COTI_ENVIADO',0);//mark quote as not send
                    message = dataServer.message;
                }else{
                    flag = true;
                    quoteTools.changeStatus('COTI_ENVIADO',1);//mark quote as sent
                    message = L('correctSentQuote');
                }
                quote.sentQuote(message,flag);
                popupLoader.close();
            },
            unsent: function(e){
                popupLoader.hide();
                var quoteTools =  new Quote();
                quoteTools.changeStatus('COTI_ENVIADO',0);//mark quote as not send
                var message = L('errorSendingQuote');
                quote.sentQuote(message,false);
                popupLoader.close();
            },
        }); 
        serverRequest.open("POST",urlRequest,false);//only in IOS,TIZEN o BB  the http request can  be synchronous
        serverRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");//headers
        params = tools.encodeBase64(parameters);//base 64 encode data
        params.replace(/\"/g, "");
        params.replace(/\'/g, "");
        var paramsRequest = {
            "deviceid":idDevice,
            "action":action,            
            "tokenid":tokenId,
            "data": params
        }; 
        serverRequest.send(paramsRequest);//sending http request
console:
[WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40e23450)

Linker error when adding iPad Deployment Target

$
0
0

I'm running into an issue where I have an application using a third-party library for credit card swiping. I include this library file into a Titanium module and add this module to my project. When my app's deployment type is set to iPhone, it compiles and runs fine on my connected iPhone 6. Unfortunately, when adding the iPad Deployment Target the app fails to build with an error:

The following build commands failed: [ERROR] : Ld build/Debug-iphoneos/DP\ Mobile.app/DP\ Mobile normal armv7

I'm compiling against 3.4.0 GA (3.4.1 produces the same issue). When I remove the module, the app builds for iPhone and iPad without an issue. My minimum OS version is 7.0.

Any thoughts, comments, ideas, etc? I'm stumped on this one.

Rob

HTTPClient: setRequestHeader('X-Requested-With', null) ignored in iOS

$
0
0

Environment

  • OS: Mac OS X Yosemite, 10.10.1
  • Mobile Platform(s): Genymotion Android 4.3 - API 18, iOS 8 - iPhone 5, 5s, 6 emulator
  • Titanium SDK: 3.4.1.GA
  • Titanium Studio: 3.4.1.201410281727

Problem

This is a follow up from this Q&A post. The gist of the problem is this: When a Titanium HTTPClient request is opened and sent, the header X-Requested-With: XMLHttpRequest is sent with the request by default. However, this header results in an error message being returned from the particular API that I'm using (shopify API).

I've set this header to null in my controller code, which fixes the problem in Android, but not in iOS as the X-Requested-With header is still being set in iOS. Is there something I'm missing?

My HTTPClient is set up as follows:

var url = 'https://shopname.myshopify.com/admin/products.json';
    var client = Ti.Network.createHTTPClient({
        timeout: 5000,
        withCredentials:true,
        validatesSecureCertificate:true
    }); 
    client.onload = function(e){
        Ti.API.info("Received text!" + this.responseText));
    };
    client.onerror = function (e){
            Ti.API.debug("error");
            Ti.API.debug(e);
    };
    client.onreadystatechange = function(e){
        Ti.API.info("state changed");
        Ti.API.info(this.readyState);
        Ti.API.info(client.getAllResponseHeaders());
        Ti.API.info("************");        
    };
 
    client.setUsername("user");
    client.setPassword("pass");
    client.open("GET", url);
        client.setRequestHeader('X-Requested-With', null);
    client.send();
As previously mentioned, this implementation works perfectly in Android. However, in looking at the raw request headers captured from the iOS simulator (using Charles), the X-Requested-With: XMLHttpRequest is still being set, which results in the error seen in the aforementioned Q&A post.

iOS Raw Request Header
GET /admin/products.json HTTP/1.1
Host: shopname.myshopify.com
X-Titanium-Id: f2e11973-5eac-4106-b95d-6690ddd8683e
X-Requested-With: XMLHttpRequest
Proxy-Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-us
Connection: keep-alive
User-Agent: Appcelerator Titanium/3.4.1 (iPhone Simulator/8.1; iPhone OS; en_US;)

Listview

$
0
0

var layout = [

{
    title: &quot;Parent 1&quot;,
    isparent: true,
    opened: false,
    sub: [
        {
            title: &quot;Child 1&quot;
        },
        {
            title: &quot;Child 2&quot;
        }
    ]
},
{
    title: &quot;Parent 2&quot;,
    isparent: true,
    opened: false,
    sub: [
        {
            title: &quot;Child 3&quot;
        },
        {
            title: &quot;Child 4&quot;
        }
    ]
}

];

How can show the above data using listview..Plez help....

Easing for ScrollableView

$
0
0

Wondering if it's possible to add easing when going to the next page within a ScrollableView element?

I've searched through the docs, plus tried using a transform maxtrix - without any luck.

Hopefully I'm missing something obvious.

Ti SDK 3.4.1 iOS 7+

In App Billing - Android

$
0
0

Hello,

I am integrating In App Billing functionality in my Titanium android app. I am facing this issue at the time of purchase product.

Currently, I am purchasing a product with this ID: android.test.purchased

for demo checking purpose.

It goes well in all step. - Query Product with ID - Query completed. - Going to purchase - Successful Payment

Then I am getting some verification and signature related error and warning and due to that I could not get Purchased Product response.

Purchase verification failed: missing data."

I all have set “Public Key” and also give “permission” and “Billing Vedding” property into ti.xml file and

This is the actual Error/Warning I am getting: E/IABUtil/Security: Purchase verification failed: missing data. [ERROR] : IabHelper: In-app billing error: Purchase signature verification FAILED for sku android.test.purchased [INFO] : Purchase response: IAB RESULT VERIFICATION FAILED

Anybody have an idea about this error why it’s not make my trascation completely.?

use dataTransform to display collection in a specific order

$
0
0

I want to display my collection in a specific order. Some of the fields have objects and I can't figure how to use a repeater for my objects in my view without messing up the order.

Some of my field is like this in the collection

foo: ['a','b','c'],

bar: ['1','2','3'],

foobar: 'cat'

What i want to do is:

{foobar}

{foo}

{bar}

so something like this

cat

a1

b2

c3

My approach is to use dataTransform and _.each that iterate through those fields and store them in a custom handler.However my dataTransform fires twice and won't display it like this. Why is that? and what is good practice when using nested objects inside a collections. Thanks! I'm fairly new to titanium and mvc.

I managed to print everything out but in the wrong order (grouping). Sample code of my current project i'm using to learn alloy.

alloy

if (OS_IOS || OS_ANDROID) {
    Alloy.Collections.MyCollection = Alloy.createCollection('MyCollection');
 
    try {
        // check for iOS7
        if (OS_IOS && parseInt(Titanium.Platform.version.split(".")[0], 10) >= 7) {
            Alloy.Globals.top = '20dp';
            Alloy.Globals.tableTop = '70dp';
        }
    } catch(e) {
        // catch and ignore
    }
}
controller
function transformFunction(model) {
    var transform = model.toJSON();
 
    var foo_data = [];
 
    //iterate through objects and store each object in a []
    _.each(transform.foo, function(data){
            var row = Ti.UI.createTableViewRow();
            var label = Ti.UI.createLabel({
                 text: data
            });
           row.add(label);
           foo_data.push(row);
    });
 
    var bar_data = [];
 
    _.each(transform.bar, function(data){
            var row = Ti.UI.createTableViewRow();
            var label = Ti.UI.createLabel({
                 text: data
            });
 
           row.add(label);
           bar_data.push(row);
    });
 
    return transform = {
        foo: foo_data,
        bar: bar_data
    };
}
view
<View dataCollection="MyCollection" dataFilter="whereFunction" dataTransform="transformFunction">
    <Label id="title" text="{foobar}"/>
    <Label text="{barfoo}"/> // just a single value
</View>
view - detail
<View class="container"> 
    <TableView data="{foo}" scrollable="false"></TableView> //repeat
    <TableView data="{bar}" scrollable="false"></TableView> //repeat
</View>

Backend php - tricky problem I can´t figure out

$
0
0

HI I have a tricky and urgent question which has made me almost pull my hair out for a day or two. Would so much appreciate some help on it!

This is the code I am working on and that I need some help with:

Background: From an api call I get a long and tedious php array. I have a function that strips this array down to a minimum and after that, saves it as json and puts it in a file on a server.

Among other thing, it stores the object "Occations". My code (I am making an app using this data) works fine, as long as there is only ONE occation.

However, sometimes "occations" consists of an array holding numerous objects. When so, several fields in the app are blank.

I want to be able to make a check = if "occations" holds more than one occation = loop through them all and pull the data I need from it.

This is a sample of the original data, when it holds just one occation:

"Occasions":{  
         "OccasionObject":{  
            "Id":19926396,
            "AttributeId":111,
            "ProductId":603298,
            "OrganizationId":1045,
            "StartDate":"2014-12-10T00:00:00",
            "EndDate":"2014-12-11T00:00:00",
            "StartTime":"0001-01-01T19:00:00",
            "EndTime":"0001-01-01T19:00:00",
            "ValidDays":"Wednesday Thursday",
            "ArenaId":55,
            "ArenaName":"Rum",
            "EntryTime":"0001-01-01T00:00:00"
         }
      },
And this is a sample of when it holds many:
"Occasions":{  
         "OccasionObject":[  
            {  
               "Id":19553154,
               "AttributeId":111,
               "ProductId":685680,
               "OrganizationId":1045,
               "StartDate":"2014-09-21T00:00:00",
               "EndDate":"2014-10-30T00:00:00",
               "StartTime":"0001-01-01T12:00:00",
               "EndTime":"0001-01-01T17:00:00",
               "ValidDays":"Tuesday Wednesday Thursday Friday",
               "ArenaId":55,
               "ArenaName":"Rum",
               "EntryTime":"0001-01-01T00:00:00"
            },
            {  
               "Id":19553155,
               "AttributeId":111,
               "ProductId":685680,
               "OrganizationId":1045,
               "StartDate":"2014-10-31T00:00:00",
               "EndDate":"2014-10-31T00:00:00",
               "StartTime":"0001-01-01T12:00:00",
               "EndTime":"0001-01-01T16:00:00",
               "ValidDays":"Friday",
               "ArenaId":555,
               "ArenaName":"Rum",
               "EntryTime":"0001-01-01T00:00:00"
            }
            ]
So. in the case of when only one occation, this is part of the final json (looking the way I want it to):
{
        "Id": 11,
        "Name": "Moviename",
        "Image": {
            "Width": 214,
            "Height": 317
        },
        "Phone": "05504-345",
        "Price": "4 biljons",
        "LongText": "Yes a long text",
        "ShortText": "Yes, short",
        "StartDate": "2014-11-12T00:00:00",
        "EndDate": "2014-11-13T00:00:00",
        "StartTime": "0001-01-01T19:00:00",
        "ValidDays": "Wednesday Thursday",
        "ArenaId": 55,
        "ArenaName": "Rum"
    },
However when several occations, the fields StartDate, EndDate, StartTime, ValidDays, ArenaId, ArenaName all are empty.

So I need to alter my coding (link in the top) so that it accepts both one and several occations. I can not figure out how to do it!

Any hints? Please?


Appcelerator Titanium Happy User

$
0
0

Guys i'am so happy for using titanuim studio and happy to deal with you for question and answer ,,

I hope you are do great job with titanium studio.

Thanx All.

Appcelerator Studio and TFS

$
0
0

I am developing for mobile (iOS and android) in an enterprise environment that is using TFS (Team Foundation Server) for it's repository.

Our Typical environment:

Apcelerator Studio 3.4.1

Xcode 6.1.1

Android API 20

TFS eclipse plugin 12.0.2

We have installed the TFS eclipse plug-in and have files checked into a single project.

What we are having an issue with is the ignore files.

Microsoft has some documentation on the .tfignore file but it's really limited to use in Visual Studio.

Microsoft Developer Network

Is there anyone out there that has an example of this?

Error Verifying License - Android Simulator

$
0
0

Hi,

I'm trying to execute my application on android simulator but I get the following immediately when the app launches:

[WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb1d2db20)
[DEBUG] :  dalvikvm: GC_CONCURRENT freed 1010K, 12% free 8420K/9504K, paused 15ms+1ms, total 23ms
[WARN] :   TiVerify: (Timer-0) [5079,5079] Verifying module licenses...
[WARN] :   TiVerify: (Timer-0) [21,5100] Error Verifying License
I'm using SDK 3.4.1 GA, Android 4.4.2 on a Mac OS X 10.10 (Yosemite)

Any ideas?

Thanks, Fernando

Titanium throws FileNotFoundException when i run an app contain an android module

$
0
0

It throw FileNotFoundException even the android module is created just now and i didn't modify anything. The studio shows that runtime.addExternalModule("com.mo", com.mo.MoBootstrap.class);this line throws the exception.

Large file download on mobile(iOS & Android) Memory Issue.

$
0
0

Hi , I am trying to download multiple files from remoteServer using HTTPClient. I am getting memory issue while downloading large files(more than 200 MB). Please suggest me what will be the solution for this? I have followed the KitchenSink app, for file download. Getting the same Memory Issue , when trying to download some larger file. Titanium HTTPClient (this.responseData) saves the data to memory before committing it to the destination like applicationDataDirectory.

What will be the good way to solve this memory Issue? How to use the FileStream operation while download under progress instead of using the complete internal memory? Is there any API available, where i can download multiple files with no memory Issue?

Viewing all 8068 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>