Extension for Deep Links on Android (Solved with example)


#1

Hi Everyone,

Example of the solution: https://github.com/Tembac/DeepLinkingHaxeflixelExample#deeplinkinghaxeflixelexample


I’m trying to make an extension to use deep linking on Android: https://developer.android.com/training/app-links/deep-linking.html

I’m using HaxeFlixel so my openfl is 3.6.1 and lime 2.9.1

I’m setting up the manifest of the extension like this, as instructed on the previous link:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.haxe.extension.deeplinking" >

	<application android:debuggable="::DEBUG::">
		<activity android:name="org.haxe.extension.deeplinking.linkActivity">
			<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="tembac.com"
					  android:pathPrefix="/breed" />
				<data android:scheme="http"
					  android:host="www.tembac.com"
					  android:pathPrefix="/breed" />
			</intent-filter>
		</activity>
	</application>

</manifest>

But I have the following error and the app is not loading on Android.

03-05 15:10:00.970 789 9734 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.tembac.bichitosMaker flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver

Someone has any clue of what can be missing?


#2

Does this help?


#3

Thanks but It didn’t help. It seem that it was an error with the JNI code.

Now I’m getting this error:

03-06 15:38:08.941 15670 15691 W System.err: java.lang.NoSuchMethodError: no static method "Lcom/deeplink/DeepLinking;.getLinkedUrl()Ljava/lang/String"
03-06 15:38:08.941 15670 15691 W System.err: 	at org.haxe.lime.Lime.onRender(Native Method)
03-06 15:38:08.942 15670 15691 W System.err: 	at org.haxe.lime.MainView$Renderer.onDrawFrame(MainView.java:718)
03-06 15:38:08.942 15670 15691 W System.err: 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
03-06 15:38:08.942 15670 15691 W System.err: 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
03-06 15:38:08.942 15670 15691 I trace   : DeepLinking.hx:25: deep linking error: JNI Exception

This is haxe code:

package;

#if cpp
import cpp.Lib;
#elseif neko
import neko.Lib;
#end

#if (android && openfl)
import openfl.utils.JNI;
#end


class DeepLinking {

	#if android

	public static var getLinkedUrl(default,null) : Void->String = function():String { return "nada"; }

	public static function init()
	{
		try {
			getLinkedUrl = JNI.createStaticMethod("com.deeplink.DeepLinking", "getLinkedUrl", "()Ljava/lang/String");
		} catch(e:Dynamic) {
			trace("deep linking error: "+e);
		}
	}
	#end


}

and java code:


package com.deeplink;


import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import org.haxe.extension.Extension;


public class DeepLinking extends Extension {

	private static String urlLinked = "no link yet.";

	/**
	 * Called after {@link #onCreate} &mdash; or after {@link #onRestart} when
	 * the activity had been stopped, but is now again being displayed to the
	 * user.
	 */
	public void onStart () {

		// setContentView(R.layout.main);
		// setContentView(Extension.mainActivity.getWindow().getAttributes())

		// Intent intent = Extension.mainActivity.getIntent();
		// String action = intent.getAction();
		// // Uri data = intent.getData();
		// urlLinked = intent.getDataString();

	}

	public static String getLinkedUrl () {

		return urlLinked;

	}

}

#4

Found that the problem was on the haxe code. Type on JNI was missing a ;

getLinkedUrl = JNI.createStaticMethod(“com.deeplink.DeepLinking”, “getLinkedUrl”, “()Ljava/lang/String;”);

Now is crashing when it receives a Deep Link:

--------- beginning of crash
03-07 05:43:37.084 22328 22328 E AndroidRuntime: FATAL EXCEPTION: main
03-07 05:43:37.084 22328 22328 E AndroidRuntime: Process: com.tembac.bichitosMaker, PID: 22328
03-07 05:43:37.084 22328 22328 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.tembac.bichitosMaker/org.haxe.extension.deeplinking}: java.lang.ClassNotFoundException: Didn't find class "org.haxe.extension.deeplinking" on path: DexPathList[[zip file "/data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/base.apk"],nativeLibraryDirectories=[/data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/lib/arm, /system/fake-libs, /data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread.-wrap11(Unknown Source:0)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:164)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6494)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.haxe.extension.deeplinking" on path: DexPathList[[zip file "/data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/base.apk"],nativeLibraryDirectories=[/data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/lib/arm, /system/fake-libs, /data/app/com.tembac.bichitosMaker-GaYCF_knD2vLWBdL-CFL-A==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
03-07 05:43:37.084 22328 22328 E AndroidRuntime: 	... 9 more
03-07 05:43:37.089   790  2082 W ActivityManager:   Force finishing activity com.tembac.bichitosMaker/org.haxe.extension.deeplinking
03-07 05:43:37.092   790   806 I ActivityManager: Showing crash dialog for package com.tembac.bichitosMaker u0

I think something is wrong with my java code but I’m sure what.

package org.haxe.extension;


import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import org.haxe.extension.Extension;
import android.net.Uri;


public class DeepLinking extends Extension {

	private static String urlLinked = "no link yet.";
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		
		Extension.callbackHandler.post(new Runnable() {
			@Override public void run() {
				//setContentView(Extension.mainView);

				// Get the intent set on this activity
				Intent intent = Extension.mainActivity.getIntent();

				// Get the uri from the intent
				Uri uri = intent.getData();

				// Do not continue if the uri does not exist
				if (uri == null) {
					return;
				}
				
				final String dataString = intent.getDataString();
				if(dataString == null)
				{
					urlLinked = dataString;
				}
			}
		});
    }



	
	public static String linkedUrl () {

		return urlLinked;

	}



}

Or maybe the problem is on the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.haxe.extension.extension" >

	<application>
		<activity android:name=".mainActivity"
			android:launchMode="singleTask">
			<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="tembac.com"
					  android:pathPrefix="/breed" />
				<data android:scheme="http"
					  android:host="www.tembac.com"
					  android:pathPrefix="/breed" />
			</intent-filter>
		</activity>
	</application>

</manifest>

#5

is “org.haxe.extension.deeplinking” the correct class name?


#6

Maybe I’m confused but I think this can’t be done with extensions.

As the manifest says, I need an activity when a link is pressed to handle it. But the Extension is not an activity so Android cannot find the activity to handle the incoming link.

I need some way to reference the main activity from the extension Manifest.


#7

Try capitalizing it, to match the declaration. I forget if it wants a fully-qualified package name, but in case it does, try “::APP_PACKAGE::.MainActivity”.


#8

Thanks but If I do this on the Manifest it gets an error when it tries to merge them.


#9

I’m pretty sure that means you are creating your own separate activity.

But now that I look at it, I think Joshua was on to something. Why is it looking for a class named deeplinking rather than DeepLinking? I don’t see either of those in your manifest file, so… are you sending a deep link that has a lowercase class name?


#10

That was a mistake I had before but I fixed it and it is still crashing when I open a link using the app. Since my last post I changed the package of the extension but it still crashing.

The extension crashes when I try to open a link with the app. It works fine when is executed.

Error:

--------- beginning of crash

03-07 17:47:27.788 20975 20975 E AndroidRuntime: FATAL EXCEPTION: main

03-07 17:47:27.788 20975 20975 E AndroidRuntime: Process: com.example.myapp, PID: 20975

03-07 17:47:27.788 20975 20975 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.myapp/com.deeplink.LinkActivity}: java.lang.ClassCastException: com.deeplink.LinkActivity cannot be cast to android.app.Activity

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2488)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread.-wrap11(ActivityThread.java)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:111)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:207)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5765)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: Caused by: java.lang.ClassCastException: com.deeplink.LinkActivity cannot be cast to android.app.Activity

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.Instrumentation.newActivity(Instrumentation.java:1072)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2478)

03-07 17:47:27.788 20975 20975 E AndroidRuntime: 	... 9 more

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.deeplink" >

	<application>
		<activity android:name=".LinkActivity"
				  android:label="::APP_TITLE::"
		android:launchMode="singleTask">
			<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="tembac.com"
					  android:pathPrefix="/breed" />
				<data android:scheme="http"
					  android:host="www.tembac.com"
					  android:pathPrefix="/breed" />
			</intent-filter>
		</activity>
	</application>

</manifest>

java:

package com.deeplink;


import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import org.haxe.extension.Extension;
import android.net.Uri;

public class LinkActivity extends Extension{

	private static String urlLinked = "no link yet.";

	//public void onCreate(Bundle savedInstanceState) {
        //super.onCreate(savedInstanceState);
		//
		// // Extension.callbackHandler.post(new Runnable() {
		// // 	@Override public void run() {
		// 		setContentView(Extension.mainView);
		//
		// 		// Get the intent set on this activity
		// 		Intent intent = getIntent();
		//
		// 		// Get the uri from the intent
		// 		Uri uri = intent.getData();
		//
		// 		// Do not continue if the uri does not exist
		// 		if (uri == null) {
		// 			return;
		// 		}
		//
		// 		final String dataString = intent.getDataString();
		// 		if(dataString == null)
		// 		{
		// 			urlLinked = dataString;
		// 		}
		// 	}
		// });
    //}

	public static String linkedUrl () {

		return urlLinked;

	}

}

Haxe

package;

#if (android && openfl)
import openfl.utils.JNI;
#end


class DeepLinking {

	public static function getLink ():String {
	
		#if (android && openfl)
		
		var resultJNI = testextension_linkedUrl_jni();
		
		return resultJNI;
		
		#else
		
		return "plataforma no soporta deep links.";
		
		#end
		
	}
	
	
	#if (android && openfl)
	private static var testextension_linkedUrl_jni = JNI.createStaticMethod("com.deeplink.LinkActivity", "linkedUrl", "()Ljava/lang/String;");
	#end

}

Include:

<?xml version="1.0" encoding="utf-8"?>
<project>

<!-- Use the following for an Android Java extension, not needed otherwise -->

	<dependency name="LinkActivity" path="dependencies/android" if="android" />
	<android extension="com.deeplink.LinkActivity" />
	
</project>

#11

Yeah, LinkActivity isn’t an Activity. You’ll need two separate classes here: one that extends Extension and another that extends Activity.


#12

Thanks!

Now it is giving me this error:

--------- beginning of crash

03-07 22:51:21.757  2019  2019 E AndroidRuntime: FATAL EXCEPTION: main

03-07 22:51:21.757  2019  2019 E AndroidRuntime: Process: com.example.myapp, PID: 2019

03-07 22:51:21.757  2019  2019 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.deeplink.LinkActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2583)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread.-wrap11(ActivityThread.java)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:111)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:207)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5765)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:4438)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.view.ViewGroup.addView(ViewGroup.java:4274)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.view.ViewGroup.addView(ViewGroup.java:4246)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:442)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:423)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.Activity.setContentView(Activity.java:2211)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at com.deeplink.LinkActivity.onCreate(LinkActivity.java:24)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:6317)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2530)

03-07 22:51:21.757  2019  2019 E AndroidRuntime: 	... 9 more


#13

Is there a way to extend the MainActivity ?

I tried with

import ::APP_PACKAGE::

.MainActivity; but it is not working.


#14

I looked up Google’s tutorial, and there’s a significant difference between their code and yours: they don’t have the line “setContentView(Extension.mainView).” (Nor do they have anything similar.)

And that’s the line that’s causing your error. Why not try deleting it?


#15

I’m following this guide. What guide are you looking?

https://developer.android.com/training/app-links/deep-linking.html

If I take that line out it doesn’t crash but it only shows a black screen with the app title on the top.


#16

Huh… I must not have been looking closely enough.

I maintain that you don’t need that line. Not in a class that extends Extension, at least. Lime handles that, and you shouldn’t need to do it again.

Try commenting out lines to pinpoint what’s causing the black screen. It can’t be the lack of setContentView(), because Extension.onCreate() lacks that too, and that didn’t cause any issues.


#17

Sorry that I took so long to get back to this. I did a workaround for the GDC build for this feature but now I will need to implement it. I’m really close.

This is the game we are making if you are curious: https://www.facebook.com/groups/2036709699921980/

The game is recognizing the link and it opens the app when clicked. But it stays on this activity that is blank. If I open the game again, it read the text from the link fine.

So what I need to do is to open and show the GameActivity from my LinkActivity. I’m looking for solutions with no luck so far. I hope someone with more native knowledge can help.

The link activity code is:

package com.deeplink;


import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import org.haxe.extension.Extension;
import android.net.Uri;
import android.util.Log;

public class LinkActivity extends Activity{

	private static String urlLinked = "no link yet.";

	@Override
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

				// Get the intent set on this activity
				Intent intent = getIntent();

				// Get the uri from the intent
				Uri uri = intent.getData();

				// Do not continue if the uri does not exist
				if (uri == null) {
					return;
				}

				final String dataString = intent.getDataString();
				if(dataString != null)
				{
					urlLinked = dataString;
				}
				Log.d("FuncaLink", "link: " + urlLinked);

    }

	public static String linkedUrl () {

		return urlLinked;

	}

}

#18

I’m triying to start the new activity like this but it can’t find the main activity package.

package com.deeplink;


import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import org.haxe.extension.Extension;
import ::APP_PACKAGE::.MainActivity;
import android.net.Uri;
import android.util.Log;

public class LinkActivity extends Activity{

	private static String urlLinked = "no link yet.";

	@Override
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

				// Get the intent set on this activity
				Intent intent = getIntent();

				// Get the uri from the intent
				Uri uri = intent.getData();

				// Do not continue if the uri does not exist
				if (uri == null) {
					return;
				}

				final String dataString = intent.getDataString();
				if(dataString != null)
				{
					urlLinked = dataString;
				}
				Log.d("FuncaLink", "link: " + urlLinked);

				//intenta ejecutar la actividad del juego
				Intent intentNewActivity = new Intent(Extension.mainContext, MainActivity.class);
				startActivity(intentNewActivity);

    }

	public static String linkedUrl () {

		return urlLinked;

	}

}

#19

Finally I got it working thanks to this post: Android - Activity and Application

So what I did was a new template with a modified main activity and manifest:

package ::APP_PACKAGE::;

import android.os.Bundle;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;

public class MainActivity extends org.haxe.lime.GameActivity {

    private static String urlLinked = "no link yet.";

     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         handleIntent();
     }

     @Override
     protected void onNewIntent(Intent intent) {
         super.onNewIntent(intent);

         // Override previous intent
         setIntent(intent);

         // Handle new intent
         handleIntent();
     }

     /**
      * Entry point for handling the activity's intent
      */
     private void handleIntent() {
         // Get the intent set on this activity
         Intent intent = getIntent();

         final String dataString = intent.getDataString();
         if(dataString != null)
         {
           urlLinked = dataString;
         }
         Log.d("FuncaLink", "link: " + urlLinked);

     }

     public static String linkedUrl () {

       return urlLinked;

    }

}

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="::APP_PACKAGE::" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::">

	<uses-feature android:glEsVersion="0x00020000" android:required="true" />
	::if (ANDROID_PERMISSIONS != null)::::foreach ANDROID_PERMISSIONS::
	<uses-permission android:name="::__current__::" />::end::::end::

	<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>

	<application android:label="::APP_TITLE::" android:debuggable="::DEBUG::"::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true">

		<activity android:name="MainActivity" android:launchMode="singleTask" android:label="::APP_TITLE::" android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"::if (WIN_ORIENTATION=="portrait"):: android:screenOrientation="sensorPortrait"::end::::if (WIN_ORIENTATION=="landscape"):: android:screenOrientation="sensorLandscape"::end::>

			<intent-filter>

				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
				<category android:name="tv.ouya.intent.category.GAME" />

			</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="tembac.com"
					  android:pathPrefix="/breed" />
				<data android:scheme="http"
					  android:host="www.tembac.com"
					  android:pathPrefix="/breed" />
			</intent-filter>

		</activity>

	</application>

</manifest>

#20

A problem is still present :frowning:

It only works if the app is closed.