I have created the react native app and added Linking. It is working fine when i open the url in the browser testapp://params.
Now i want this link to be shared to other apps. So i used react-native-share library to share this. But this library just shows string as text but not clickable. How do i make this text as clickable so that when user clicks that link it will open my app.
let shareOptions = {
title: "React Native",
message: "Hola mundo",
url: "testapp://", //Here this should be clickable
subject: "Share Link" // for email
};
Share.open(shareOptions);
Can any one please help me.
Edit: apologies for the misunderstanding. To configure your app to be opened via a link is different depending on the platform.
IOS
First add the following to your Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>testapp</string>
</array>
</dict>
</array>
If editing in Xcode and not a text editor, create a key called "URL types", under Item 0 create a key called URL Schemes and set Item 0 under URL Schemes equal to a String testapp (or whatever the link should be)
Next in your AppDelegate.m file add this under your last import
#import <React/RCTLinkingManager.h>
Finally, add the following to your `AppDelegate.m` file under `#implementation AppDelegate`
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
Now entering testapp:// into an address bar will open your app
Unfortunately making this link clickable via iMessage will not work. Your best option instead is to host a simple webpage with the following script:
<script>
window.location = "testapp://"
</script>
Then you could host it at www.testapp.com and it would open your app when the user navigates there.
Android
Add an intent-filter to your AndroidManifest.xml file
<intent-filter android:label="filter_react_native">
<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="testapp" /> // A
</intent-filter>
That's it! Now http://testapp will open your app on android AND be clickable.
Related
Plugin UI are developed in a separate MVC project and CMS 12 is in another projects. Following is a test solution that just to explain the issue we are having.
Solution structure
Please consider followings
The TestAddon project is a Simple MVC project with basic UI. We need to get this UI rendered in a CMS 12 Admin menu. We have created a menu provider as well.
Then build the TestAddon project and copied DLLs to CMS-> bin folder.
Created module/_protected folder and added TestAddon/TestAddon.zip
module.config was created as described in the documentation(https://world.optimizely.com/documentation/developer-guides/CMS/configuration/Configuring-moduleconfig/)
<module productName="TestAddon" loadFromBin="false" tags="EPiServerModulePackage" clientResourceRelativePath="1.0.0">
<assemblies>
<add assembly="TestAddon" />
<add assembly="TestAddon.Views" />
</assemblies>
<route url="{controller}/{action}" >
<defaults>
<!--<add key="moduleArea" value="TestAddon" />-->
<add key="controller" value="CustomAdminPage" />
<add key="action" value="Index" />
</defaults>
</route>
<clientResources>
<!-- <add name="myscript" path="ClientResources/index.js" resourceType="Script" ></add> -->
</clientResources>
<clientModule>
<moduleDependencies>
<add dependency="CMS" />
<add dependency="Shell"/>
<add dependency="EPiServer.Cms.UI.Admin" type="RunAfter"/>
<add dependency="EPiServer.Cms.UI.Settings" type="RunAfter"/>
</moduleDependencies>
<requiredResources>
</requiredResources>
</clientModule>
</module>
Set Auto discovery in startup file
services.Configure<ProtectedModuleOptions>(x => x.AutoDiscovery = EPiServer.Shell.Configuration.AutoDiscoveryLevel.Modules);
When we then start the project it is giving following error
Error Screenshot
Stacktrace
When we removed the auto discovery setting form startup class. It works to build the project
Does anyone have experienced this?
Please point me in a correct direction
You don't need to copy files to your sample project for local testing. You can add a project reference to your add-on project instead, then add this in your sample project's startup so the files are loaded correctly:
var moduleName = typeof(SomeClassInYourAddOn).Assembly.GetName().Name;
services.Configure<CompositeFileProviderOptions>(options =>
{
options.BasePathFileProviders.Add(new MappingPhysicalFileProvider(
$"/EPiServer/{moduleName}",
string.Empty,
Path.GetFullPath($"..\\..\\src\\{moduleName}")));
});
services.Configure<ProtectedModuleOptions>(options =>
{
options.Items.Add(new ModuleDetails { Name = moduleName });
});
Not sure if this is needed, but I don't think protected modules are auto discovered. So if you have a configuration method in your add-on that consumers of your add-on need to call, then you can add this in the method:
var moduleName = typeof(SomeClassInYourAddOn).Assembly.GetName().Name;
services.Configure<ProtectedModuleOptions>(options =>
{
if (!options.Items.Any(i => i.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase)))
{
options.Items.Add(new ModuleDetails() { Name = moduleName });
}
});
Then your add-on is added even if auto discovery is not enabled.
I am using Orbeon's feature for generating PDFs and it works fine. But I need to use custom template for some of my forms as well. Since I already have code generating these custom template PDFs I would like to combine it with Orbeon's built in PDF feature.
Currently I have two buttons on my xforms - regular Orbeon PDF button (which genrates PDFs using Orbeon's built in functionality) and custom button, which sends xform data to my custom service generating PDFs using my template and gets back PDF file.
I have my button and service configured like this:
<property as="xs:string" name="oxf.fr.detail.buttons.view.my_app.*">mypdf pdf</property>
<property as="xs:string" name="oxf.fr.resource.my_app.*.cs.buttons.mypdf" value="My PDF"/>
<property as="xs:string" name="oxf.fr.detail.process.mypdf.my_app.*">
send(
uri = "http://localhost:8080/myApp/getPdfXform",
replace = "all",
method = "post",
content = "xml",
annotate = "id",
nonrelevant = "remove"
)
</property>
The problem I have is that mypdf button returns file called "view", which is my custom template PDF, but not with a name I generated in my service. In another words Orbeon replaces my custom filename with "view".
I tried to configure it using this property
<property as="xs:string" name="oxf.fr.detail.pdf.filename.*.*" value="'testname'"/>
but it seems to apply only to PDFs generated by Orbeon, which makes sense.
My question is if there is a way to get file from my service with fileName I gave it?
Thank you.
My app requires custom user agent addition like "***; myAppUA".
For example, in webview I can do it:
String userAgent = settings.getUserAgentString();
userAgent += "; myAppUA";
settings.setUserAgentString(userAgent);
But I cannot find how to do it in Crosswalk.
I found patch here:
https://github.com/Reconers/cordova-plugin-crosswalk-webview/commit/f2b5d44b66a50b8fa4eeea9810c20cc29c601147
Now you can add in config.xml in app:
<preference name="AppendUserAgent" value="myAppUA" />
I want to provide a file upload to Google App Engine with the "GWT Upload" (https://code.google.com/p/gwtupload/). During the upload I get an error. As UploadAction servlet I use the build in: gwtupload.server.gae.AppEngineUploadAction
The servlet is configured in the web.xml in the following way:
<context-param>
<!-- max size of the upload request -->
<param-name>maxSize</param-name>
<param-value>3145728</param-value>
</context-param>
<context-param>
<!-- Useful in development mode to slow down the uploads in fast networks.
Put the number of milliseconds to sleep in each block received in the server.
false or 0, means don't use slow uploads -->
<param-name>slowUploads</param-name>
<param-value>200</param-value>
</context-param>
<servlet>
<servlet-name>uploadServlet</servlet-name>
<!-- This is the default servlet, it puts files in session -->
<servlet-class>gwtupload.server.gae.AppEngineUploadAction</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>*.gupld</url-pattern>
</servlet-mapping>
During upload the progress bar progresses some percentages and then shows the following error:
But there are no more details in the logs.
The error message shows the class gwtupload.server.gae.MemCacheFileItemFactory$CacheableFileItem with the method setHeader(). That's strange because I can't find the method in that class. What's happening here?
Edit:
This is basically all the custom code i use. On the server side i use the build in gwtupload.server.gae.AppEngineUploadAction servlet.
package com.uploadtest.client;
import gwtupload.client.IUploadStatus.Status;
import gwtupload.client.IUploader;
import gwtupload.client.IUploader.UploadedInfo;
import gwtupload.client.MultiUploader;
import gwtupload.client.PreloadedImage;
import gwtupload.client.PreloadedImage.OnLoadPreloadedImageHandler;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class GWTUploadTest2 implements EntryPoint {
// A panel where the thumbnails of uploaded images will be shown
private FlowPanel panelImages = new FlowPanel();
public void onModuleLoad() {
// Attach the image viewer to the document
RootPanel.get("thumbnails").add(panelImages);
// Create a new uploader panel and attach it to the document
MultiUploader defaultUploader = new MultiUploader();
RootPanel.get("default").add(defaultUploader);
// Add a finish handler which will load the image once the upload finishes
defaultUploader.addOnFinishUploadHandler(onFinishUploaderHandler);
}
// Load the image in the document and in the case of success attach it to the viewer
private IUploader.OnFinishUploaderHandler onFinishUploaderHandler = new IUploader.OnFinishUploaderHandler() {
public void onFinish(IUploader uploader) {
if (uploader.getStatus() == Status.SUCCESS) {
new PreloadedImage(uploader.fileUrl(), showImage);
// The server sends useful information to the client by default
UploadedInfo info = uploader.getServerInfo();
System.out.println("File name " + info.name);
System.out.println("File content-type " + info.ctype);
System.out.println("File size " + info.size);
// You can send any customized message and parse it
System.out.println("Server message " + info.message);
}
}
};
// Attach an image to the pictures viewer
private OnLoadPreloadedImageHandler showImage = new OnLoadPreloadedImageHandler() {
public void onLoad(PreloadedImage image) {
image.setWidth("75px");
panelImages.add(image);
}
};
}
In addition to that i added the following jars to my clath path:
log4j-1.2.17.jar
gwtupload-gae-0.6.6.jar
gwtupload-0.6.6.jar
commons-fileupload-1.3.jar
commons-io-2.4.jar
Also zipped my whole sample project and uploaded it here:
https://skydrive.live.com/redir?resid=60B826E451F52B4D!118&authkey=!ALa1n2mL2sRR0wU
Edit 2:
Like Manolo pointed out: I was using "commons-fileupload-1.3.jar" instead of "commons-fileupload-1.2.1.jar". Changing the jar fixed my problem!
The problem is in the version of the commons-fileupload you are using, change it to the version 1.2.1, which is the one pointed in the gwtupload documentation.
It should work with 1.2.2 as well, but to use 1.3 requires new methods (setHeaders) which are not in the UploadListeners provided with gwtupload.
You should change in your project the target java (JDK compliance) to 1.6, since it is the last one supported in GWT to avoid problems, although it runs in 1.7.
Need to know the procedure for overlaying multiple KML files on a single Google Map that is displayed in the browser. The KML files intended for this can point to different locations. Ex:KML1 for North America & KML2 for Asia. Could anyone help me out in this.
I think you are looking for this:
http://code.google.com/apis/kml/documentation/kml_tut.html#network_links
example:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Network Links</name>
<visibility>0</visibility>
<open>0</open>
<description>Network link example 1</description>
<NetworkLink>
<name>Random Placemark</name>
<visibility>0</visibility>
<open>0</open>
<description>A simple server-side script that generates a new random
placemark on each call</description>
<refreshVisibility>0</refreshVisibility>
<flyToView>0</flyToView>
<Link>
<href>http://yourserver.com/map1.kml</href>
</Link>
</NetworkLink>
<NetworkLink>
<name>Random Placemark</name>
<visibility>0</visibility>
<open>0</open>
<description>A simple server-side script that generates a new random
placemark on each call</description>
<refreshVisibility>0</refreshVisibility>
<flyToView>0</flyToView>
<Link>
<href>http://yourserver.com/map2.kml</href>
</Link>
</NetworkLink>
</Folder>
</kml>
You can do it with Google Maps JS API. You need to create overlays with google.maps.KmlLayer for each KML files.
See this example: http://code.google.com/apis/maps/documentation/javascript/examples/layer-kml.html
API Documentation:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers