NativeScript URL Handler Plugin trouble to make it working - nativescript

I am trying to use this plugin with Nativescript Angular.
I followed the tutorial Nativescript Url Handler
In my app.component.ts :
ngOnInit() {
handleOpenURL((appURL: AppURL) => {
console.log('Got the following appURL', appURL);
alert(appURL);
});
}
In android manifest :
<activity
android:name=".activities.Activity"
android:label="#string/app_name">
<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="example.com"
android:pathPrefix="/"/>
</intent-filter>
And when I input to my Google Chrome navigator : http://example.com/ or http://www.example.com/ ,
it does not work. Any help, i would appreciate.

I don't think hitting URL on Chrome's address bar will open your app. It should be a link, when you click the link it would try to open your app.
For example, even YouTube - if you hit youtube.com it will still open it in Chrome browser. If you click a Youtube video link may be from a Google search, then it would try to launch the app.
Also do not forget to try a clean build.

Related

Gmail Contextual Gadget Not Visible in Gmail

I am trying to develop one gmail gadget. I have prepared my gadget.xml file after reading all the required peoint mentioned in the google documents. But after that they ask to make a manifest file. But as far I have searched, now we don't need to prepare any manifest file. Now, we can prepare it through Google Apps Marketplace SDK. I have prepared a manifest here and saved it and enabled it from console.developers.google.com.
But after that also, I am not able to see my gadget in Gmail. Please any experienced developer help me in this problem. I trying to solve this problem from long time.
Here is my gadget.xml code:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs author="Company Name" height="500" author_email="abc#example.com" author_location="India">
<Require feature="dynamic-height"/>
<Require feature="views" />
<Require feature="google.contentmatch">
<Param name="extractors">google.com:MessageIDExtractor</Param>
<Param name="extractors">google.com:SenderEmailExtractor</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<p> Pragmatic Odoo Gmail Integration</p>
<script>console.log('Hello from gadget.')</script>
]]>
</Content>
</Module>
Here is my Google Apps Marketplace SDK settings for gadget:
enter image description here
Pay attention to below hints:
Add an app to chrome web store and link it to your Google project, which you describe contextual gadget, with project ID.Here's a sample of web store manifest.json:
{
"manifest_version": 2,
"name": "Sample App",
"short_name": "Dev",
"version": "1.0.0",
"default_locale": "en",
"description": "Sample app",
"app" : {
"launch" : {
"web_url" : "http://yourcompany.com"
}
},
"icons": {
"128": "icons/128x128-icon.png",
"16": "icons/16x16-icon.png"
},
"container": ["DOMAIN_INSTALLABLE"],
"api_console_project_id": "your-project-id"
}
After publish this app, add it to test Google Domain. Since your gadget is in development stage so, don’t publish your app to Public. There are different "Visibility options" that you can choose.
To disable cache use nogadgetcache=1 (e.g. https://mail.google.com/?nogadgetcache=1)
Login with admin account which you want to test it, otherwise take more time to update manifest.
After Modify “Google Apps Marketplace SDK” click on “Test Installation Flow” to be sure there is no new permission.
I did these part and works for me:
Define google.com:MessageIDExtractor as first extension, however you don’t need that.
I recommend that select every scopes which you want to use in other
extensions here! I don’t know why put it seems the google just ask
these permission for my gadget
Define Param extractor in gadget.xml separately not with comma:
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:MessageIDExtractor
</Param>
<Param name="extractors">
google.com:SenderEmailExtractor
</Param>
</Require>

Gmail contextual gadget doesn't appear after GAM SDK Test install

I cannot manage to see a contextual gadget in Gmail after Test Install Flow in Google Apps Marketplace SDK.
These are the steps I took to create the project, logged as a domain administrator:
create Google Apps console project
create OAuth2 client
enable GAM SDK
configure the SDK page with COB extension:
Extractor Url: google.com:HelloWorld
GadgetUrl: URL of gadget spec
Extractor param name: Test
Extractor param value: .*
Scopes: Mail - Subject Line, Mail - Message Body
I didn't add any additional Oauth2 scopes than the userinfo.email and userinfo.profile that are already there, and the Universal Navigation link is just a file that redirects to Gmail( since I am trying a very simple variant of the project to see if I can get it to work ).
I press Test Install flow, I am asked to give permissions in a Oauth combined window, I am redirected to my Universal navigation link, then Gmail. The app appears in the Google Apps Admin control panel and seems to have installed successfully, it is ON for all domain users.
I tried Gmail with different domain users, cleared cache, logged out and back in to Gmail, I am probably missing a configuration somewhere.
This is the gadget spec:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Title" description="Desc" author="" author_email="" author_location="" scrolling="false" height="20">
<Require feature="dynamic-height"/>
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:HelloWorld
</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
for (var match in matches) {
for (var key in matches[match]) {
listItem = document.createElement('LI');
extractedText = document.createTextNode(key + ": " + matches[match][key]);
listItem.appendChild(extractedText); matchList.appendChild(listItem); }
}
document.body.appendChild(matchList);
gadgets.window.adjustHeight(100);
</script>
]]>
</Content>
</Module>
Couple of suggestions -
Use the nocache option to force your Gmail UI to update. Use this link - https://mail.google.com/mail/u/0/?nogadgetcache=1#inbox
Try as a different account on the domain. I've seen some cases where the "developer/admin" inbox takes time to update

Launch Intent from account-authenticator accountPreferences screen?

I have included the AccountManager code in my app to enable the user to create and manage their account from inside their Settings application.
I linked in the "accountPreferences" preferences file inside my account-authenticator definition, and the options show properly in the Settings > Accounts > My App screen. When I tap on one of them, instead of getting the activity I linked in, I get:
01-14 14:47:27.304: ERROR/AndroidRuntime(27708): FATAL EXCEPTION: main
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:944)
at android.app.ContextImpl.startActivity(ContextImpl.java:931)
at android.preference.Preference.performClick(Preference.java:967)
at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:215)
I have the intents inside my PreferenceScreen defined as:
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.myapp.android"
android:targetClass="com.myapp.android.activities.AccountForwardingActivity"/>
And the target activity is also defined as you'd expect, with no special flags other than an intent-filter to match that action (I have other custom actions listed as well).
<activity android:name=".activities.AccountForwardingActivity"
android:theme="#style/Theme.MyApp"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.myapp.android.PAYMENT_TYPES"/>
<action android:name="com.myapp.android.ADDRESS_LIST"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
What am I doing wrong? How can I mark this intent, launched from Settings.apk, to be a new task?
My problem was putting the Preference Screens inside my PreferenceCategory.
This works fine:
<PreferenceCategory android:title="General Settings" />
<PreferenceScreen
android:title="Account Settings"
android:summary="Favorites, Orders, and more.">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.myapp.android"
android:targetClass="com.myapp.android.activities.AccountForwardingActivity"/>
</PreferenceScreen>
Nesting that PreferenceScreen inside the PreferenceCategory does not work, and results in the error above.

NPAPI plugin not working in Firefox5.0 on Mac

I have a NPAPI plugin (built using firebreath) which works fine Safari and Google Chrome (both on Mac); But it fails to work on Firefox.
When I looked at the Firefox plugins (about:plugin) it correctly shows my plugin name and version and shows it as Enabled.
Following is the code I use to load the plugin in javascript -
<object name="fp" type="application/x-myplugin" width="0" height="0">
<embed name="jsPlugin" id="jsPlugin" width="0" height="0" type="application/x-myplugin">
</embed>
</object>
And I use this plugin as follows -
function PluginVwersion(){
var jsPlugin = document.getElementById('jsPlugin');
jsPlugin.GetScannerDetails();
}
But whenever I test this code in firefox, it doesn't work, and I see following error in the Error Console -
Error: jsPlugin.GetScannerDetails is not a function
Source file: file:///Users/u162794/Desktop/test.html
Any help is appreciated.
Regards,
Yogesh Joshi
Why exactly are you trying to use an embed tag inside an object tag? Remove the embed tag, set your object tag id to jsPlugin, and then try it.
<object id="jsPlugin" type="application/x-myplugin" width="0" height="0"></object>
Also try using the example FBControl.htm file that is created in the build/projects//gen folder in your project like is suggested on the FireBreath website.

Rhomobile: Custom URL Schemes

I'm writing a Rhomobile application targeted at iPhone and Android.
I need to create a custom url scheme, so that i can create urls that look like test://some-params that will launch my program and will pass it the params.
As far as I understand this is done in build.yml through the BundleURLScheme parameter, and then System.get_start_params() to get those parameters.
However, this works on the iPhone only as far as I understand.
Is there any way to make this work on Android too?
Thanks alot!
OKay, I've found the answer myself, in case anybody needs this too:
Create an extension to the application as explained here:
http://docs.rhomobile.com/rhodes/extensions#generating-a-native-extension-template
Add an android_manifest_changes file, as decribed in the above link.
In that file add the following lines:
<manifest xmlns:android='http://schemas.android.com/apk/res/android'
android:versionName='1.0' package='com.rhomobile.webbrowserpoc'
android:versionCode='10000' android:installLocation='auto'>
<application android:name='com.rhomobile.rhodes.RhodesApplication'
android:label='#string/app_name' android:icon='#drawable/icon'
android:debuggable='true'>
<activity android:name='com.rhomobile.rhodes.RhodesActivity'
android:label='#string/app_name' android:launchMode='singleTask'
android:configChanges='orientation|keyboardHidden'
android:screenOrientation='unspecified'>
<intent-filter>
<action android:name='android.intent.action.VIEW' />
<category android:name='android.intent.category.BROWSABLE' />
<category android:name='android.intent.category.DEFAULT' />
<data android:pathPrefix='' android:scheme=''
android:host='' />
</intent-filter>
</activity>
</application>
Only the <data android:pathPrefix='' android:scheme='' android:host='' /> line should be filled in with correct properties.

Resources