Software Archive
Read-only legacy content
17061 Discussions

runInstallNativeApp - parameters

Mike_B_7
New Contributor I
1,025 Views

I am new to Android development and am trying to use the "intel.xdk.device.runInstallNativeApp" - but I'm struggling trying to get the parameters correct.

I can run the sample - with some slight modifications (pulled from the app manifest), but there is a parm that I am not sure about for the app I am trying to launch.

Modified Sample from the SDK:

Boomtown Manifest:
 
...
package="com.appMobi.applab.boomtown">
...
<action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="applab.boomtown"/>
      </intent-filter>
    </activity>
 
// This works in my Crosswalk for Android app
intel.xdk.device.runInstallNativeApp('Boom Town!', 'applab.boomtown://', 'market://details?id=com.appMobi.applab.boomtown', 'com.appMobi.applab.boomtown');
 
 
// Application Manifest
// App I am trying to start - I can get this to work - but its starting the camera from within the app -- not the main app
...   
 <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="gfmobile_video_test"/>
      </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="gfmobile" android:host="il"/>
      </intent-filter>
 
// works - launches globoforce video recorder if installed, otherwise takes you to the market
//intel.xdk.device.runInstallNativeApp('Globoforce','gfmobile_video_test://','market://details?id=com.globoforce.android','com.globoforce.android');
 
// DOES NOT WORK (nothing happens) - Not sure what to do with the "android:host="il" in the manifest - 
intel.xdk.device.runInstallNativeApp('Globoforce', 'gfmobile://', 'market://details?id=com.globoforce.android', 'com.globoforce.android');
 
 
 
 
 
       
 
        

 

 

0 Kudos
1 Solution
Mike_B_7
New Contributor I
1,025 Views

Yes, I have done research into "intents", and have already found a work around for the "Android".  This "Bridge API" is supposed to work for both iOS and Android and was hoping to take advantage of that.

Looking at the webpage - https://software.intel.com/en-us/node/493033 - it doesn't mention anywhere that I could see that this function is being deprecated.

Since I am writing this for both Android/Apple, I was hoping to use the suggested API call - not have to re-invent the wheel.

For others, here is what I did as a Android Work around:

Check if App is installed (plugin):
     https://www.npmjs.com/package/cordova-plugin-appavailability

Launch Installed App (plugin):
     http://phonegap-plugins.com/plugins/madansingh18/launchnativeapp

If not Installed - Open Playstore to the apps page:
        var sAppUrl = "https://play.google.com/store/apps/details?id=com.globoforce.android";
        navigator.app.loadUrl(sAppUrl,{openExternal:true});
 

Please have someone update  the online documentation. If this is function/API is going to be deprecated, say so on the web page . If it's not, correct the example so that we don't spend days spinning our wheels and asking for help in the forumn. 

 

View solution in original post

0 Kudos
7 Replies
Amrita_C_Intel
Employee
1,025 Views

I would recommend going through this article.

http://qnimate.com/install-or-run-a-app-using-intel-xdk/

 

Can you elaborate your issue? What you are to do ? and where are you failing?

0 Kudos
Mike_B_7
New Contributor I
1,025 Views

Thanks for the reply.  Here is more information.  Forgive the long explanation, a lot of this was in the original post, but I guess I didn't do a good job of making my question clear. J

I have looked at both the below articles on using the "runInstallNativeApp" api call – they are pretty much cut and paste between the two, and both are currently incorrect. Also, neither of them explain what/how to get the "protocolHandler" parameter.

http://qnimate.com/install-or-run-a-app-using-intel-xdk/
https://software.intel.com/en-us/node/493033

Incorrect Code – The gray highlighted sections are incorrect:

// Android example – INCORRECT (Does not work)
intel.xdk.device.runInstallNativeApp('Boom Town', 'applab.boomtown://', 'market://details?id=com.intel.xdk.applab.boomtown', 'com.intel.xdk.applab.boomtown');
 

Loading the "Boom Town!" app onto my phone and then looking at the app manifest with a Android 3rd party tool such as "Stanley", you can see that the application and bundleID are incorrect  and the appName should be 'Boom Town!' with an exclamation.

// Android example – CORRECT Works !!
intel.xdk.device.runInstallNativeApp('Boom Town!', 'applab.boomtown://', 'market://details?id=com.appMobi.applab.boomtown', 'com.appMobi.applab.boomtown');

Here is the part of the Boom Town app Manifest that was used to determine the correct values for the example call:

BOOMTOWN APP MANIFEST

...
package="com.appMobi.applab.boomtown">
...
<action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="applab.boomtown"/>
      </intent-filter>
    </activity>

Once the correct parameters were determined, the call works. 

QUESTION:

Now the REAL question is for the application that I am trying to launch, I don't k now how to specify the correct "protocolHandler" which includes a "host" part.

The app I am trying to launch, allows for 2 "intent-actions".  The first one, is simple and launches correctly.  The second has a "host" parameter that I'm not sure how to specify with the "runInstallNativeApp" call.

Intent 1: WORKS
appName: 'Globoforce'
protocolHandler: 'gfmobile_video_test://'
appLocation: 'market://details?id=com.globoforce.android'
bundleID: 'com.globoforce.android'


// Call - WORKS
intel.xdk.device.runInstallNativeApp('Globoforce','gfmobile_video_test://','market://details?id=com.globoforce.android','com.globoforce.android');

Intent 2: DOES NOT WORK – nothing happens or the call causes my app to error out.

appName: 'Globoforce'
protocolHandler: 'gfmobile://'   -- how do I specify the host of "il"?
appLocation: 'market://details?id=com.globoforce.android'
bundleID: 'com.globoforce.android'

// Call – Does Not Work 

intel.xdk.device.runInstallNativeApp('Globoforce','gfmobile://','market://details?id=com.globoforce.android','com.globoforce.android');

Question: How do I specify the "host" in the "protocolHandler" ?

<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="gfmobile" android:host="il"/>
</intent-filter>

I have tried the following calls – the first two show that something is working – the rest are with no success.

// works for boomtown – 1

intel.xdk.device.runInstallNativeApp('Boom Town!', 'applab.boomtown://', 'market://details?id=com.appMobi.applab.boomtown', 'com.appMobi.applab.boomtown');

// works - launches globoforce video recorder - 2          intel.xdk.device.runInstallNativeApp('Globoforce','gfmobile_video_test://','market://details?id=com.globoforce.android','com.globoforce.android');

// failed  - 3
intel.xdk.device.runInstallNativeApp('Globoforce', 'gfmobile://', 'market://details?id=com.globoforce.android', 'com.globoforce.android');

// failed  - 4
intel.xdk.device.runInstallNativeApp('Globoforce', 'gfmobile://il', 'market://details?id=com.globoforce.android', 'com.globoforce.android');

// failed - 5           
intel.xdk.device.runInstallNativeApp('Globoforce','','market://details?id=com.globoforce.android','com.globoforce.android');

// failed  - 6
intel.xdk.device.runInstallNativeApp('Globoforce', null, 'market://details?id=com.globoforce.android', 'com.globoforce.android');

// failed - 7
intel.xdk.device.runInstallNativeApp('Globoforce','gfmobile.il://','market://details?id=com.globoforce.android','com.globoforce.android');

// failed - 8
intel.xdk.device.runInstallNativeApp('Globoforce', 'il.gfmobile://', 'market://details?id=com.globoforce.android', 'com.globoforce.android');

// failed  - 9
intel.xdk.device.runInstallNativeApp('Globoforce', 'gfmobile.globolforce.android://', 'market://details?id=com.globoforce.android', 'com.globoforce.android');

Any thoughts?

If someone could update the Intel documentation, that would be great, also, where is the code for the APP PREVIEW --> Demo Apps --> API DEMO? 

0 Kudos
Mike_B_7
New Contributor I
1,025 Views

Just noticed that the highlighting didn't carry over from Word.

Incorrect sections are bolded:

// Android example – INCORRECT (Does not work)
intel.xdk.device.runInstallNativeApp('Boom Town', 'applab.boomtown://', 'market://details?id=com.intel.xdk.applab.boomtown', 'com.intel.xdk.applab.boomtown');

0 Kudos
PaulF_IntelCorp
Employee
1,025 Views

The APIs you are using are based on the legacy Android build system, which will be retired (it has been deprecated). We highly recommend that you use the Cordova build and app development process. To find ways to work with Android intents, try searching the web for something like the following "cordova app intent android" and you should find the info you need.

The XDK builds standard Cordova apps, the build part of that system is in the cloud, not local, so you do not have the "CLI" component on your system.

0 Kudos
Mike_B_7
New Contributor I
1,026 Views

Yes, I have done research into "intents", and have already found a work around for the "Android".  This "Bridge API" is supposed to work for both iOS and Android and was hoping to take advantage of that.

Looking at the webpage - https://software.intel.com/en-us/node/493033 - it doesn't mention anywhere that I could see that this function is being deprecated.

Since I am writing this for both Android/Apple, I was hoping to use the suggested API call - not have to re-invent the wheel.

For others, here is what I did as a Android Work around:

Check if App is installed (plugin):
     https://www.npmjs.com/package/cordova-plugin-appavailability

Launch Installed App (plugin):
     http://phonegap-plugins.com/plugins/madansingh18/launchnativeapp

If not Installed - Open Playstore to the apps page:
        var sAppUrl = "https://play.google.com/store/apps/details?id=com.globoforce.android";
        navigator.app.loadUrl(sAppUrl,{openExternal:true});
 

Please have someone update  the online documentation. If this is function/API is going to be deprecated, say so on the web page . If it's not, correct the example so that we don't spend days spinning our wheels and asking for help in the forumn. 

 

0 Kudos
PaulF_IntelCorp
Employee
1,025 Views

I've added a deprecation notice to the main table of contents page, and have requested that we get that notice on more of the pages in that book.

0 Kudos
Mike_B_7
New Contributor I
1,025 Views

That would be great.  

Bummer though that this is being deprecated.  It would have been very convenient to use.  

0 Kudos
Reply