Titanium JIRA Archive
Appcelerator Community (AC)

[AC-428] URL scheme Android returns null

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2015-11-21T18:51:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsStudio
Labelsandroid, handler, scheme, url
ReporterJan van Kampen
AssigneeSharif AbuDarda
Created2015-09-24T10:01:14.000+0000
Updated2015-12-23T16:40:09.000+0000

Description

I want to add an URL handler to my app. Currently, the app is opening when I open 'myapp://history', but there is no way to receive 'history' in the app. I followed a bunch of tutorials, including the tutorial of Fokke, but the intent data is always null. tiapp.xml
                <activity
                    android:configChanges="keyboardHidden|screenSize"
                    android:launchMode="singleTask"
                    android:name="org.appcelerator.titanium.TiTranslucentActivity" android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar">
                    <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>
                </activity>
First lines of alloy.js
if (OS_ANDROID) {
	var platformTools = require('bencoding.android.tools').createPlatform(),
	    wasInForeGround = true;

	setInterval(function() {
		var isInForeground = platformTools.isInForeground();

		if (wasInForeGround !== isInForeground) {
			if (isInForeground) {
				console.log('start');
				console.log(Ti.Android.currentActivity.getIntent());
				console.log('stop');
			}
			wasInForeGround = isInForeground;
		}
	}, 2000);
}

Comments

  1. Sharif AbuDarda 2015-11-15

    Hello, Can you take a look at these community links below? [Link1](https://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android) [Link2](https://developer.appcelerator.com/questions/tag/url%20scheme) [Link3](https://developer.appcelerator.com/question/162165/tiandroidcurrentactivityintentdata-always-null-when-application-resume) Thanks.
  2. Rene Pot 2015-12-23

    Links provided do not show a solution. Note: this is an alloy application (I am co-worker of Jan, therefore my response :) )
  3. Thijs 2015-12-23

    I'm experiencing exactly the same problems. Also in Common JS/Classic Titanium. Links provided do not provide any solution.

JSON Source