with android 2.x i could use the solution
browserIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity")
resolved in the post:
opening local html file with Android Browser
but with android 3.2 i have this error:
Unable to find explicit activity class
(com.android.browser/com.android.browser.BrowserActivity);
have you declared this activity in your AndroidManifest.xml?
I think that the class com.android.browser.BrowserActivity doesn't exist in Android 3.x
Any solution?
Not a satisfying solution, but in a demo application I alternatively used the following code:
String url = "content://com.android.htmlfileprovider/sdcard/mydir/myfile.html";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "text/html");
startActivity(intent);
Usually at least one of the two works.
https://github.com/nicolas-raoul/OxygenGuide-Android/blob/master/src/org/github/OxygenGuide/MainActivity.java#L69
intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity")
Will open whatever app has the packagename "com.android.browser". The issue with using this is that over various versions of android and various manufacturers, the default browser changes. For example Nexus devices tend to come pre-installed with the chrome app, which has a different package name.
Unable to find explicit activity class
(com.android.browser/com.android.browser.BrowserActivity);
have you declared this activity in your AndroidManifest.xml?
The error you have copied explains that there is no application with that package name browserIntent.setClassName() is used to open a specific app explicitly which means it shouldn't provide a prompt asking which browser you would like to use.
If this is what you want to avoid (pop up), then you can check what browsers are on the device and possibly suggest downloading it before making links clickable.
you also could use the code from the other suggestion.
String url = "content://com.android.htmlfileprovider/sdcard/mydir/myfile.html";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "text/html");
startActivity(intent);
This specifies that you want to open an activity that can handle the "text/html" type data. By viewing it. This would provide you with a list of applications (different installed browsers) for you to select.
Uri uri = Uri.parse(url);
Intent browserIntent = new Intent(Intent.ACTION_VIEW);
browserIntent.setDataAndType(uri, "text/html");
browserIntent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(browserIntent);
Related
The only plugin I can find is this one https://github.com/EddyVerbruggen/Custom-URL-scheme
I try to install it and check its iOS implementation, it is empty inside plugins/cordova-plugin-customurlscheme/src/ (no ios folder found, only android and window). I check the plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js, the content is:
"use strict";
/*
Q: Why an empty file?
A: iOS doesn't need plumbing to get the plugin to work, so..
- Including no file would mean the import in index.html would differ per platform.
- Also, using one version and adding a userAgent check for Android feels wrong.
- And if you're not using PhoneGap Build, you could paste your handleOpenUrl JS function here.
*/
It doesn't make sense, based on my understanding, it should implement func application(_application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:] ) -> Bool in the AppDelegate, but it is empty. In this case, how come overwrite handleOpenURL in the JS will work?
I really couldn't find others, can anyone advise similar workable plugin? My scenario is, when A app call B app, my B app is a cordova app, and I need a listener/callback to capture the url content.
Updated:
added in MAF tag, as the issue was caused by Oracle MAF framework, didn't expect that, thought the issue coming from Cordova.
It should not implement something in iOS. Custom URL scheme only updates Info.plist in iOS. So, it's fine. It REGISTERS custom URL schemes.
To handle the URL them you need to right your own code. How plugin will know what you need when custom URL is opened?
Alright, I know why there is no such implementation in https://github.com/EddyVerbruggen/Custom-URL-scheme
That is because in cordova-ios CDVHandleOpenURL.m, it already contained such implementation, it will consume the notification which is posted by the CDVAppDelegate.m, and in the CDVHandleOpenURL.m, it will execute handleOpenURL in the WebView JavaScript namespace.
The reason why my apps is not working, it is because Cordova was wrapped in the Oracle MAF framework, and it overwrite the custom URL mechanism provided by Cordova, which is not what I expected, so I forgot to mention MAF in my original question, I will add in related information.
reference:
https://docs.oracle.com/middleware/maf210/mobile/develop-maf/maf-ui-remote-url.htm#ADFMF24147
I am using Akavache standard approach on iOS (actually, it's .NET Standard project for Android/iOS), but the issue appears with iOS only.
I save some value during the app lifecycle:
await BlobCache.Secure.InsertObject("user", user);
And on the app new session this:
var user = await BlobCache.Secure.GetObject<UserModel>("user");
But the object is not available (with KeyNotFoundException exception).
Recently I also was trying to call BlobCache.Secure.Flush().Wait() right after the object saving, but there is still no effect.
The issue happens with iOS only. Android is fine.
The issue happens with both Secure and UserAccount objects.
The data is not available even after "gentle" BlobCache.Shutdown().Wait() on the application closing. So, have no idea even where to search the solution now.
Any thoughts why might cause this issue and how I can solve it?
There's another issue people have had is that the SqlLite cache is getting linked out. If you check the type on LocalMachine and it's of type MemoryCache that won't be resilient.
Just add the linker static class somewhere in your project (even if it's a PCL or Standard lib).
That worked for me.
Did you set the ApplicationName property on BlobCache? On iOS this seems more of a necessity than on Android it seems.
Embedded WebExtensions talks all about how to "... embed a WebExtension in a classic bootstrapped extension or an Add-on SDK add-on."
But I've got neither a "bootstrapped" nor "Add-on SDK" extension, just a decade old plain old XPCOM/overlay extension. I don't have a bootstrap.js to have a startup, nor do I use the Add-on SDK for whatever it does.
I tried adding
<em:bootstrap>true</em:bootstrap>
But all that accomplishes is completely destroying the extension, it only loads that (empty) new bootstrap.js file.
Indeed, I want to migrate: The data that my classic extension has needs to be exported to the webext version, for good user experience.
At our tracking bug a user has posted a helpful link:
https://github.com/mdn/webextensions-examples/tree/master/embedded-webextension-overlay
Which boils down to
const {
LegacyExtensionsUtils,
} = Components.utils.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
const myOverlayEmbeddedWebExtension = LegacyExtensionsUtils.getEmbeddedExtensionFor({
id: addonId, resourceURI: baseURI,
});
myOverlayEmbeddedWebExtension.startup().then(({browser}) => {
dump(`${addonId} - embedded webext started\n`);
browser.runtime.onMessage.addListener(msg => {
dump(`${addonId} - received message from embedded webext ${msg}\n`);
});
}).catch(err => {
Components.utils.reportError(
`${addonId} - embedded webext startup failed: ${err.message} ${err.stack}\n`
);
});
Which is surely the equivalent of what the bootstrap/SDK code is doing for you.
You can only rewrite it from scratch using the WebExtension APIs.
Note that the WebExtensions model requires you only use the APIs explicitly exported for use by extensions, so prepare to drop some features during the rewrite, or even to find that it's impossible to reimplement the extension altogether (unless you convince Mozilla to implement the new APIs you need or implement it yourself in a WebExtension Experiment -- still limited to Nightly/Dev.edition).
See Porting a legacy Firefox extension
[edit] the "embedded WebExtension" does indeed require your "outer" extension to be bootstrapped or Add-on SDK-based (so no "classic" extensions), but it was only intended to be used for gradual migration and will not work in Firefox 57.
One option that I suggest to the people in similar situations, is to provide an Export function in the current legacy addon and an Import in the WebExtension version. While it is not an automatic migration (has to be user action), it overcomes some of the limitations of the WebExtension local-file access.
Using the Export, users will be prompted to save their complete data to hard-disk.
Then the next upgrade which would be a WebExtension, prompts the users to Import the saved data.
I'm having a web reference which is being used by both a Xamarin IOS application, Xamaring Android application, and a Windows Store application.
And this all worked very well, until I updated Xamarin.
Now, there is a field that But it works fine for the Android and Windows applications.
I have tried to update the web reference multiple times, with no luck. I have also tried to debug the web service locally, to see if it returns the same , which it does.
When I receive it in my Windows Store app., it looks like this:
And in my IOS app., it looks like this:
It is always the StructureId that is never set, for some reason. And it was not like that before I updated Xamarin.
Anyone who knows what I am doing wrong, or have stumbled onto the same kind of problem ?
That looks like the linker removed unused members. Defaults have not changed (it's not related to your update) but you should check that your application is being built with Link SDK (and not Link all).
If you want a smaller executable and set Link all to achieve this then you'll need to add [Preserve] attributes on the structure you're serializing (e.g. used in web services).
I was able to make it work. I am not sure if it cached anything, or what, but it helped to add some "noise" on the webservice call.
I just added DateTime.Now.Ticks to my webservice URL in Reference.cs, so it would always be a new URL call:
this.Url = "http://somewebsitename.com/ReportService/ReportService.asmx?v=" + DateTime.Now.Ticks;
public BrowserFieldDemoScreen()
{
BrowserField mybroBrowserField=new BrowserField();
add(mybroBrowserField);
mybroBrowserField.displayContent("
<html><body><h1>hello world! This blackbery apps
</h1></body></html>", "http://localhost");
}
I'm new in Blackberry application development, I have load html in browser and I have write code for that it works perfectly for more than OS version 5.
But I have create app for 4.6.1.310 model number 8900 not working giveing some uncaught Exception. Please tell me what I have to change so that it should work on 4.6.1.310 version also,
You cannot use BrowserField class below Blackberry OS 5.0
Before running application go through sdk docs.
The BlackBerry Facebook SDK was written to use embedded browser functionality, before (5.0) BrowserField was available. I believe that code is free to use and modify to your needs.
see the project here
Look in the sample code (scroll down the page) at his LoginScreen class.
You should be able to modify that class to serve your purposes. This particular class, of course, has a hardcoded URL that points to Facebook. You will obviously change that to accept whatever URLs you like, and remove other references to facebook classes you don't need. You will definitely need more than just the LoginScreen class, but all its dependencies should be available on that site.
Post a comment if there's any problems getting this to work. I have some other legacy code that does this successfully, but I'm not free to post it ... but quickly looking at the Baskoro code I linked to appears like it does basically the same thing.