It works on iOS...

seen from Russia
seen from China

seen from United States

seen from Malaysia
seen from China
seen from China

seen from United Kingdom
seen from United States
seen from United States

seen from Malaysia

seen from Czechia
seen from United States

seen from Malaysia
seen from Italy
seen from Russia
seen from United Kingdom
seen from United Kingdom
seen from Australia

seen from United States

seen from United Kingdom
It works on iOS...
Android Intents: Using an HTTP URL to open an app
I have the following requirement. A user taps on a link in an email or on a web page and it opens up my app and passes through some data (to pre-populate a form). I had no issues doing this on iOS buy using a custom protocol (e.g. myapp://form?data1=1&data2=2) but on Android I ran into an issue. When the app is already open (i.e. it is resumed) when you tap on the link, the data in the URI is not passed through. It is fine when you open the app from scratch but it strips the data when the app is already open.
This lead me to try using Android Intents using an HTTP URL to open the app. The example on the Appcelerator website (http://docs.appcelerator.com/platform/latest/#!/guide/Android_Intent_Filters-section-43287610_AndroidIntentFilters-URIIntentFilterExample) did not work for me. I then read Fokke’s two part article on URL Schemes (see: http://fokkezb.nl/2013/08/26/url-schemes-for-ios-and-android-1/ and http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/). He included an important element - you should include the path in the intent filter. That allowed me to get it going.
I had one other requirement. I still wanted to be able to use registered protocols (e.g. myapp://) to open the app, as well as HTTP URLs (e.g. http://mayapp.com/open?type=form&data1=1&data2=2). Below is the code that I used in my TiApp.xml file to get this going.
<android xmlns:android="http://schemas.android.com/apk/res/android"> <manifest android:installLocation="auto" android:versionCode="1" android:versionName="1.0.0.0"> <application android:theme="@style/Theme.MyApp"> <activity android:name=".MedicamActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true"> <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"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="myapp" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="myapp.com" android:path="/open" /> </intent-filter> </activity> </application> ... </manifest> </android>
Wherever you see "myapp" replace with your app name.
Now, whenever you tap on a link to http://myapp.com/open?type=form&data1=1&data2=2 your app will open and the data will be passed through. To capture the data simply use the following in the index.js (root controller).
if (OS_ANDROID) { alert(Ti.App.Android.launchIntent.getData()); }
Note that when you tap on the link in the browser it will prompt you to open the link in your app or in the browser. Once you select your app it will ask "just once" or "always". This is not ideal but still okay for my needs. It could be a bit of a pain if the user selects "browser" and "always"!
I hope this helps.
Quick Reference. Android Image & Icon sizes for Different Densities.
I am constantly looking this stuff up so I thought I would put it all in the one place for easy access. It is the different densities for Android relative to iOS ... and the different icon sizes for different Android screen densities.
#densityTable { width: 100%; } #densityTable td, #densityTable th { border: 1px solid #CCC; padding: 5px 10px }
Density Name Density Label DPI Baseline Icon size iOS Equivalent Low ldpi 120 75% 36x36 Medium mdpi 160 100% 48x48 Normal High hdpi 240 150% 72x72 Extra High xhdpi 320 200% 96x96 Retina @2x Extra Extra High xxhdpi 480 300% 144x144 Retina @3x Extra Extra Extra High xxxhdpi 640 400% 192v192
Prevent the Back button from closing the app (Titanium on Android)
I have an app that has a bunch of screens and it is not uncommon to want to hit the back button in quick succession to navigate back to the home page. The problem is, if you hit that back button one too many times it closes the app. I did not want to completely disable the back button to close the app as that is how a lot of people close the app. I don’t want to annoy people. Here is a solution to prevent help with this.
On the homepage of your app (where you want to prevent the app from closing) put this in the controller.
$.index.addEventListener("android:back", function(e) { var dialog = Ti.UI.createAlertDialog({ cancel: 1, buttonNames: ["Close", "Cancel"], message: "All data not submitted will be lost. Are you sure you want to close the app?", title: "Close the app" }); dialog.addEventListener("click", function(e){ if (e.index === 0) { Ti.Android.currentActivity.finish(); } }); dialog.show(); });
I hope it helps someone.
(WIP) Work in progress, updates soon.
Mobile app for iOS and Android.