Friday, 28 June 2013

Use of IPhone URL Schemes

// Here is the example of how to Use of IPhone URL Schemes.

// How to use it ?

// IPhone URL Schemes is very easy and very helpful to use.

// This page centralizes code samples for URL schemes available in many iPhone applications, not only in Apple's but in many others. It also includes programming tips and references about implementing apps registering or consuming URL schemes. 

//Below link is very helpful to developer

 http://wiki.akosma.com/IPhone_URL_Schemes#SMS 

In example we can easily open below iPhone Application

            1)  Open Maps
            2)  Open SMS
            3)  Open Dialer
            4)  Open YouTube

            5)  Open App Store / Market
            6)  Open Skype
            7)  Open Gmail
            8)  Open Safari
            9)  Open Music
          10)  Open iBook


But for that we have application install in iPhone.

Otherwise it can not open.

Test that application in phone not a simulator because in simulator you get less idea compare to phone.

So check it in LIVE DEVICE.

Sample code for how to use  iPhone URL Schemes available on GIT : )

 https://github.com/dharmik/URLSchemes

i) snap :)


                                                       ii) snap :)
                                                                                                              iii) snap :)



Friday, 21 June 2013

Use custom JSON file in ALLOY



// Here is sample code of how to use custom JSON file in alloy

// In this code there is simple map functionality is available in that map all the coordinates like

1) Longitude
2) Latitude
3) Name

All above parameter are coming from Custom JSON file.

So We can easily Create custom json file and also pin it to MAP.

Sample code is available on Git.

Here is LINK :)

https://github.com/dharmik/Custom-JSON-File

Snap-Shot :)

Tuesday, 11 June 2013

Get Profile Detail With The Help Of Gravatar E-mail Address .

// With the help of Gravatar email address you can get its Profile Detail like
  • Name
  • Profile Pic
  • FamilyName
  • FullName
  • Location
 // So no need to take profile detail from user if user have gravatar account. :)

CODE :)
https://github.com/dharmik/Gravatar-ProfileDetails


Helpful Link :) 
https://en.gravatar.com/site/implement/profiles/json/

Tuesday, 28 May 2013

Text to Speech in Appcelerator Using Google Translater(In Alloy)

// I just Test it in iOS But i think it also work fine in android  :)

// The Best part is in this example is   http://translate.google.com/translate_tts?tl=en&q=  . Google    provide us this link to easily convert any text in to speech .

index.xml

<Alloy>
    <Window class="container">
        <Label id="label" onClick="doClick">Sound Play with the use of google translater Click Here.</Label>
    </Window>
</Alloy>

index.tss

".container": {
    backgroundColor:"white"
},
"Label": {
    width: Ti.UI.SIZE,
    height: Ti.UI.SIZE,
    color: "#000"


index.js

function doClick(e) {
    var name = 'Appcelerator is Very Good Platform'; // You can write any thing here :)

    var googleUrl = 'http://translate.google.com/translate_tts?tl=en&q=' + name;
    var xhr = Titanium.Network.createHTTPClient();
    xhr.open("GET", googleUrl);
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.send();

    xhr.onerror = function(e) {
        alert('On Error');
    }

    xhr.onload = function() {
        var player = Ti.Media.createSound({
            url : googleUrl
        });
        player.play();
    }
}

$.index.open();

Screen Shot : )



Custom Html file open in webView in appcelerator(In Alloy)

// Its very simple create your own HTML file and you can easily add in appcelerator and open it in webView.

// I checked it in iOS .

// Try starting your HTML file with a simple <HTML> tag only. You don't need the doctype info in there. I had the same problem and that's how I fixed it.

index.js
 $.index.open();

var webview = Titanium.UI.createWebView({url:'index.html'}); // Path of html file
$.map.add(webview);


index.tss

".container": {
    backgroundColor:"white"
},
"Label": {
    width: Ti.UI.SIZE,
    height: Ti.UI.SIZE,
    color: "#000"


index.xml

<Alloy>
    <Window class="container">
        <View id="map"/>
    </Window>
</Alloy>

index.html file Dropbox link.

https://dl.dropboxusercontent.com/u/72783403/AtoZ/index.html

ScreenShot : )


Loading Style for iPhone in Appcelerator(In ALLOY)

index.xml

<Alloy>
    <Window class="container">
        <View id="backdrop"/>
        <View id="container">
            <ImageView id="loader"/>
            <Label id="message" textid="Loading..."/>
        </View>
    </Window>
</Alloy>

index.js

$.loader.images = [
    '/img/loading/load-cloud1.png',
    '/img/loading/load-cloud2.png',
    '/img/loading/load-cloud3.png',
    '/img/loading/load-cloud4.png',
    '/img/loading/load-cloud5.png',
    '/img/loading/load-cloud6.png',
    '/img/loading/load-cloud7.png',
    '/img/loading/load-cloud8.png',
    '/img/loading/load-cloud9.png'
];

$.start = function() {
    $.loader.start();
};

$.stop = function() {
    $.loader.stop();
};

$.setMessage = function(key) {
    $.message.text = "Loading...";
};

$.start();


$.index.open();

index.tss

'#container': {
    layout:'vertical',
    height:Ti.UI.SIZE
},

'#backdrop': {
    backgroundColor:'#232323',
    opacity:0.75
},

'#loader': {
    width:'75dp',
    height:'46dp'
},

'#message': {
    color:'#ebebeb',
    textAlign:'center',
    height:Ti.UI.SIZE,
    width:Ti.UI.SIZE,
    font: {
        fontSize:'12dp',
        fontWeight:'bold',
        fontFamily : "PFDinDisplayPro-Regular"
    }
}





All the images, pleases download from this dropbox link

https://dl.dropboxusercontent.com/u/72783403/loading.zip

Screen Shot :)


 

Friday, 24 May 2013

Generate CSV file in Appcelerator

// In app.js file just write this code

Part i -

var csv = require('exportCsvData');
 
var win = Ti.UI.createWindow({
    backgroundColor:'#ccc',
    title:'CSV Import Module'
})
 
var createCsv = Titanium.UI.createButton({
    title:'CSV',
    top:'140',
    left:'110',
    height:'40',
    width:'115',
    color:'black'
});
win.add(createCsv);
 
createCsv.addEventListener('click', function(e){
   var input = [
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"]
   ];
   
   var op = csv.exportCsvData(input);
   alert("Output file path = "+ op);
});
 
 
win.open();
 
 
 

// Create on exportCsvData.js file 

Part ii -

exports.exportCsvData = function(input)
{
 
    var rowTxt = "";
    for(var i=0;i < input.length; i++){ // row iteration
        for(var j = 0; j < input[i].length; j++){ // column iteration
            rowTxt += '"' + input[i][j] + '"';
  
            if(j < (input[i].length-1))
            {
                rowTxt += ',';
            }
        }
        rowTxt += '\n';// adding new line at end of row
    }
 
    // creating output file in application data directory
    var outputFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'output.csv');
    // writing data in output file
        outputFile.write(rowTxt);
 
 
    if(outputFile.exists){
        alert("CSV generated!!!");
    }
     
    // return output file path
    return outputFile.nativePath;   
}