I want to know how to display a webpage of a predefined URL in Blackberry. I would also like to get help in displaying map of a predefined location on a button click.
displaying a web page is straightforward:
public static void navigateToSite(final String url) {
BrowserSession session = Browser.getDefaultSession();
session.displayPage(url);
}
and for the location, check http://docs.blackberry.com/en/developers/deliverables/11944/CS_invoking_BB_Maps_using_a_Landmark_887800_11.jsp
Related
I have an application on Xamarin Android, and I need to open a PDF, but I have the Document in a byte array, because I use it from an Api web. And in the Syncfusion documentation, I did not find much information, just the method "Assets.Open (" GIS Succinctly.pdf ");", which opens the document from a "string", is there any way to pass the arrangement to PdfViewer?
SfPdfViewer pdfViewer;
string Mail, Pass, LlaveEmp = string.Empty;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.RecibosPago);
pdfViewer = FindViewById<SfPdfViewer>(Resource.Id.pdfviewercontrol);
Stream PdfStream = Assets.Open("GIS Succinctly.pdf");
pdfViewer.LoadDocument(PdfStream);
}
At present we do not have a direct support to display the PDF document from URL using web API in SfPdfViewer in Xamarin.Android. However, as a workaround we can download the PDF document from URL as Stream using WebClient class and load it in the SfPdfViewer.
The below KB link illustrates how to display PDF document from URL using SfPdfViewer in Xamarin.Android:
Syncfusion KB link
Please let us know if you need any other assistance.
Regards,
Sathish.
Syncfusion Support
I am using Xamarin.Form to write a Android app. I have successfully implemented the OAuth and I can sign in and get the user information using OAuth2Authenticator.
When the user clicks signup/Login I show the OAuthLoginPresenter as follows:
var oAuthLoginPresenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
oAuthLoginPresenter.Login(App.OAuth2Authenticator);
This works great and the user sees the login page.
When the user clicks Allow the completed Event on the OAuth2Authenticator instance fires as expected and the user is once again back looking at the app.
However this is where my problem is - I get a notification:
If CustomTabs Login Screen does not close automatically close
CustomTabs by Navigating back to the app.
Thing is though I am back at the app. If I look at all my open apps I can see the login screen is still running in the back ground so that presenter has not closed.
In my intercept Activity which gets the redirect looks like this:
[Activity(Label = "GoogleAuthInterceptor")]
[IntentFilter
(
actions: new[] { Intent.ActionView },
Categories = new[]
{
Intent.CategoryDefault,
Intent.CategoryBrowsable
},
DataSchemes = new[]
{
// First part of the redirect url (Package name)
"com.myapp.platform"
},
DataPaths = new[]
{
// Second part of the redirect url (Path)
"/oauth2redirect"
}
)]
public class GoogleAuthInterceptor: Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your application here
Android.Net.Uri uri_android = Intent.Data;
// Convert Android Url to C#/netxf/BCL System.Uri
Uri uri_netfx = new Uri(uri_android.ToString());
// Send the URI to the Authenticator for continuation
App.OAuth2Authenticator?.OnPageLoading(uri_netfx);
Finish();
}
}
Am I missing a step in here to close that presenter? Any other ideas please?
UPDATE:
I have now found that using Chrome as the default browser works fine and presenter is closed. But if I use a Samsung browser as my default browser - it does not close.
So I need a way to close it manually.
Just set property to null when initializing Xamarin.Auth in your main activity:
//don't show warning message when closing account selection page
CustomTabsConfiguration.CustomTabsClosingMessage = null;
I can not be more clear with the title :D
Is it possible? to launch an application on a blackbeery just cliking on a "link" inside a mail? i read about taping a url and going to the application but this is much more specific.
thx in advance
Actually you can listen incoming emails.
You can implement menu item that will be available in mail app.
But you can also implement content handler with specific URI to launch your app.
All examples are available in BB samples.
Look in the RIM sample apps, more specifically HTTPFilterDemo.
You have to register a filter for the type of link you need the app to be triggered by (you'll need to put this code in the main method of you app):
HttpFilterRegistry.registerFilter("www.rim.com","com.rim.samples.device.httpfilterdemo.filter");
where "www.rim.com" is obviously the link that should open the app and the second parameter is the package that contains the "Protocol" class. The Protocol class has a callback method:
public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException {
This method will be called each time the user clicks on a link that has the form specified by you. So, to open the app, in the "openFilter" method, do:
int modHandle = CodeModuleManager.getModuleHandle("YourAppModuleName");
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
try {
ApplicationManager.getApplicationManager().runApplication(apDes[0]);
} catch (ApplicationManagerException e) {
e.printStackTrace();
}
I want to initially load a page (stored html page) with the BrowserField and then have links clicked in that open up in the BB browser instead of the BrowserField?
My current code is as following,
BrowserFieldConfig.setProperty(BrowserFieldConfig.CONTROLLER, new BrowserFieldController()
{
public InputConnection handleResourceRequest(BrowserFieldRequest request) throws Exception {
return (InputConnection)Connector.open(request.getURL());
}
public void handleNavigationRequest(BrowserFieldRequest request) throws Exception
{
BrowserSession b = Browser.getDefaultSession();
b.displayPage(request.getURL());
}
});
And I want to load the html page stored in resources in browserfield and then open the links from the page in BB Browser which I'm doing using
browserfield.requestContent("local:///test.html");
But application tries to open the html file in browser, which is not desirable.
Please suggest me a workaround,
Thanks,
Aniket
This should be quite easy to achieve.
Firstly you will need to use the BrowserField object instead.
Extend the browser field's javascript engine, by using BrowserField.extendScriptEngine(String name, Scriptable scriptable)
Within the Scriptable you will open the native browser.
In the html, make the buttons execute the extended javascript function you created.
The handleNavigationRequest(BrowserFieldRequest request) method is called each time the browserfield requests content.
Add a count inside the method.
Increment the count by 1 each time the method is called.
If the count is greater then 0, it means the Browserfield has already loaded the first time. Subsequent calls to the method should then open a browser session instead of requesting content inside the Browserfield.
public void handleNavigationRequest(BrowserFieldRequest request) throws Exception
{
if(click<1){
// request for content inside Browserfield
}
else {
BrowserSession b = Browser.getDefaultSession();
b.displayPage(request.getURL());
}
click++;
}
I've been trying to find a way to add a listener to the BlackBerry BrowserField for when the user clicks a link and the URL changes. I have tried adding a BrowserFieldListener below, but I keep getting a warning message declaring that Document cannot be resolved as a type. Any suggestions on capturing when a user clicks a link and it takes them to a certain URL?
BrowserFieldListener listener = new BrowserFieldListener(){
public void documentLoaded(BrowserField browserField, Document document) throws Exception
{
browswerField.setTitle("Example");
}
};
browserField.addListener(listener);
Are you importing the declaration of Document somewhere?
I do something similar using the BrowserField to pars HTML, see my blog posting here.