CaptainStealthy
CaptainStealthy

Reputation: 388

Adobe Flex Mobile 4.6 - Launching app from browser

I'm trying to start development on a Flex Mobile app that my company is developing in Adobe AIR (using Flash Builder). The app will initially be released for iPhone and Android, and eventually BlackBerry PlayBook tablets as well.

However, one of the requirements is that we need to be able to launch the app from the browser on the device, and pass a parameter into it.

I'm not sure what I am doing wrong, but I can't get this to work. I've put the following block of code in the Android section. I'm just working with Android for the moment, for initial testing. Its easy to drop an APK onto an Android device, and I've got one sitting right here.

            <application>
                <activity android:name=".MyUriActivity">
                    <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" android:host="path" /> 
                    </intent-filter> 
                </activity> 
            </application>

I've also got this code for handling the event:

import mx.events.FlexEvent;

        protected function application_preinitializeHandler(event:FlexEvent):void
        {
            NativeApplication.nativeApplication.addEventListener(
                InvokeEvent.INVOKE, onInvoke);
        }

        private function onInvoke(event:InvokeEvent):void
        {
            // You can parse argument value from event.arguments property
            Text1.text = "Arguments: " + event.arguments;
        }

The allowBrowserInvocation flag is set to true.

I tried creating a test HTML page with the following links, but I just get a "Webpage not available" message in the Android browser.

<a href="myapp:">myapp:</a>

<br><br>

<a href="myapp:#Intent;action=android.intent.action.view;end">click to load apk</a>

I've read all of the following posts, but I'm still having trouble. Can someone please help me out? What am I missing?

How to register some URL namespace (myapp://app.start/) for accessing your program by calling a URL in browser in Android OS?

How to implement my very own URI scheme on Android

Open a Native AIR app via URL?

Upvotes: 1

Views: 3000

Answers (1)

CaptainStealthy
CaptainStealthy

Reputation: 388

Okay...I'm not sure what I did, maybe the break I took for a glass of water helped. But when I just tried it again, it works.

I cleared out the manifest section, and tried again, with the example from this site:

http://dreamingwell.com/articles/archives/2011/06/flex-mobile-cus-2.php

And now it works...but I thought I tried that already...

(Moved from comments to an actual answer, now that StackOverflow is allowing me to do so)

Upvotes: 1

Related Questions