Wednesday, December 14, 2016

How to transfer an App from one ORG to another.

Currently, it's not possible. You have to republish App to that ORG. And you can do it by replacing code.
Just backup and delete this project then create a new project with the same name and replace the code.
Code replacement is quite easy. Just delete the App folder to the newly created project then copy the App folder from the existing project and paste it into the newly created project. 

Note: For classic app do the same for the Resource folder.

If you use any module then include it in your app tiapp.xml file. That's it.

Thanks

Setup Android SDK to the Appcelerator Studio for windows PC

At first, download the Android SDK then place it inside the"C:" directory and show the location to the
Axway Appcelerator Studio>>Preferences>>Studio>>Platforms>Android>Android SDK Home
Then click on Install SDKs>> Now select all android 8.X.X, v7.X.X  and install those packages. 
If you face any issue then try to setup android SDK via the command prompt
  • appc ti config android.sdk  <SDK location>
  • appc ti setup android
  • And restart PC 
Also, take a look android SDK installation guide -
Hope this helps.

Push notification sample code

Appcelerator provided subscribed device token code with iOS 10 or later devices have some problem.
Actually, this portion of code is not working

Ti.Platform.name == "iPhone OS"

So please take a look this sample code for push notification

Hope this helps.

Monday, December 12, 2016

Working with commonJS module pattern.

app.js


var win = Ti.UI.createWindow({
backgroundColor : 'green',
layout : "vertical"

});

win.open();

// Create a Button.
var request = Ti.UI.createButton({
title : 'Add view',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE,
top : 20,

});

request.addEventListener('click', function(e) {

var addView = require('/lib/viewFile');

var label_view = new addView();

win.add(label_view);
});

win.add(request);


// Create a Button.
var nextWindow = Ti.UI.createButton({
title : 'nextWindow',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE,
top : 50

});

nextWindow.addEventListener('click', function(e) {


var nextPage = require('lib/newWin');
var Next_win = new nextPage();
Next_win.open();
//nextPage.createData();


});

win.add(nextWindow);



//ExampleView File

lib/viewFile.js


function view() {

var view = Ti.UI.createView({
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
layout : "vertical",
backgroundColor : 'red'
});

var mars = Ti.UI.createLabel({
text : 'Top 10 pics from Mars!',
top : 20,
width : Ti.UI.SIZE,
height : 30

});
view.add(mars);

view.addEventListener("click", function(e) {

var hello = require("/lib/operation");
hello.sayHello("Mars is bigger than earth");

});

// Creating label in window B, note that the same transitionName is used.
var marsB = Ti.UI.createLabel({
text : 'Top 10 pics from Mars!',

top : 20,
width : Ti.UI.SIZE,
height : 30,

});

view.add(marsB);

return view;
};
module.exports view;


/lib/operation.js


var defaultMessage = "Hello world";
// we make objects, variables, functions available to the
// calling context by adding them to the exports object
exports.sayHello = function(msg) {
alert('Hello '+msg);
};
// we can assign other objects, functions, and variables to
// exports and they will be available to the calling context
exports.helloWorld = function() {
Ti.API.info(defaultMessage);
};


/lib/newWin.js


function newWin() {

var window = Ti.UI.createWindow({
backgroundColor : 'white'
});

var textField = Ti.UI.createTextField({
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
color : '#336699',
width : 250,
height : 60
});

textField.addEventListener('click', function() {
Ti.API.info('in text field click');
});

window.add(textField);

return window;

}


module.exports = newWin;



//Project Structure










Sunday, December 4, 2016

Deploy your nodeJS app to the Heroku server in a minutes.

Just create an account to the heroku site
- https://dashboard.heroku.com/

Then download the heroku CLI and install it in your machine
- https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up

Now open the your terminal and type the following code to deploy your App

- heroku login
- heroku create YourAppName
- cd LocalPCproject/
- git init
- heroku git:remote -a YourAppName
- git add .
- git commit -am "make it better"
- git push heroku master
- heroku open

That's it.

If you change something in your app then deploy it again

- git add .
- git commit -am "make it better"
- git push heroku master

Hope this helps

Sending push via firebase API key.


 You can import a cloud enable project into Firebase. Basically similar, the end result will be a new key is generated. The steps for this are:
  • Log into Firebase console
  • https://console.firebase.google.com
  • Go to Add project >>Add Firebase to your existing project (From the Project name)
  • Select "Project Settings" from the gear menu
  • Select the "CLOUD MESSAGING" Tab and use the server key.


Note: Make sure your Appcelerator ID and package name is same











For creating new firebase project

https://documentation.onesignal.com/docs/generate-a-google-server-api-key


(Till steps 2)

Thanks.

Thursday, December 1, 2016

Appcelerator studio install on linux system

Linux systems require the GTK windowing system, Node.js, and the JDK to be installed before running Studio. So make it compatible with this link

https://platform.appcelerator.com/#/product/cli
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Then install CLI using the following command

- sudo npm install -g appcelerator
- appc use latest
- appc setup

And take a fresh copy of Appcelerator Studio and install it in your machine.

https://web.appcelerator.com/product/studio

Note: Officially Appcelerator do not have Linux support.

http://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix-section-29004837_TitaniumCompatibilityMatrix-OperatingSystem

Hope this helps.

When Studio open get an error on startup, windows platform.


Please try this following command via the terminal. 

appc logout -D
npm install -g appcelerator
appc use latest
appc config set proxyServer null
appc setup
appc login

Then open Appcelerator Studio and let us know if it works for you.

Wednesday, April 23, 2014

Android:Best practices to use default them.

Android Default Them:

Android allows you to set the appearance of your application using themes.A theme specifies default colors, fonts, and images, for an Android activity or an entire application. Your application can use the device's built-in themes, or include custom themes. By default, Titanium applications use a custom theme called Titanium for their main activity.

If you try to use an unsupported theme, you will either receive a build error that
the resource cannot be found or a runtime error that the theme is not supported.

At First, create a theme XML file in ./platform/android/res/values. Do NOT name the file theme.xml. . 
If you create a file called theme.xml, it will overwrite the default Titanium one and break the build process.
//platform/android/res/values/builtin_themes.xml
<!-- Works for Titanium SDK 3.2.x and earlier when built against Android 4.0x/API Level 14 -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
      <!-- Available for Android 4.0.x/API Level 14 and later -->
      <style name="LightDarkBar" parent="@android:style/Theme.Holo.Light.DarkActionBar"/>
      <!-- Available for Android 3.0.x/API Level 11 and later -->
      <style name="Light" parent="@android:style/Theme.Holo.Light"/>
      <style name="Dark" parent="@android:style/Theme.Holo"/>
      <!-- Available for all Android versions -->
      <style name="OldLight" parent="@android:style/Theme.Light"/>
      <style name="OldDark" parent="@android:style/Theme.Black"/>
</resources>


Finally, to use a theme in your application, modify the Android section of your tiapp.xml file to reference the style name you want to use

<android xmlns:android="http://schemas.android.com/apk/res/android">
       <manifest>
             <application android:theme="@style/LightDarkBar"/>
             <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
        </manifest>
</android>

For more details:Android Theme

What do you mean by Memory leaks? And how to fix it.

Memory leaks occur when your app allocates memory but doesn't release it. Leaks occur when unintended or overlooked references to objects remain in scope. When this happens, JavaScript can't garbage collect the objects and Titanium can't destroy the native proxies. Because the causes of leaks vary so widely, at best we'll be able to give you some strategies to attempt in order to solve the problems. There are no "cookie cutter" solutions for stopping memory leaks.


The efficient tips for memory management in Titanium:

1)    Include minimum files in app.js

2)    Release objects from memory to avoid crashes and app slowness

3)    Assign objects to null instead of hiding them

4)    Remove app level events after usage

5)    Create variable using var

6)    Assign global scope to null