Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

SGWT.mobile email copmposer

$
0
0
Hi folks,

I am using the SGWT.mobile beta framework and would like to create a mailcomposer using a native plugin re: depending on the device the local/native composer will be used as part of the phonegap compile. I am really struggling to find any options in how I achieve a SGWT.mobile mail composer functionality

p.s. I am happy to code a custom one assuming i can access the device contacts etc; alternatively, a native implementation might be the most efficient option if possible so pls advise.

lastly i have copied and exert from another GWT forum (all credits to the google forum on this) but not sure whetehr this is plausable.

appreciate any suggestions

cheers
frank

MailPlugin mp = (MailPlugin) GWT.create(MailPlugin.class);
mp.initialize();
phoneGap.loadPlugin("webintent", mp); // is webintent webintent.js or can I use webIntent too ???




public interface MailPlugin extends PhoneGapPlugin {
public void sendMail(String subject, String body);
}




public class MailPluginPhoneGapImpl implements MailPlugin {

private EventBus handlerManager = new SimpleEventBus();
private boolean initialized;
private JavaScriptObject mp;

@Override
public void initialize() {

try {
mp = initializeNative();
initialized = true;
} catch (JavaScriptException e) {
throw new IllegalStateException("could not initialize Childbrowser plugin");
}




public native JavaScriptObject initializeNative() throws JavaScriptException/*-{
var instance = this;
var mp = null;
// ios has to use a complet other plugin
//android
if (mp == null) {
if (typeof ($wnd.plugins) != "undefined" && $wnd.plugins != null) {
if (typeof ($wnd.plugins.webIntent) != "undefined"
&& $wnd.plugins.webIntent != null) {
cb = $wnd.plugins.webIntent;
}
}
}

// no init found throw....
if (mp == null) {
throw "no webintent plugin found";
}

return mp;

}-*/;

@Override
public void sendMail(String subject, String body) {
// create mail object
}

Viewing all articles
Browse latest Browse all 4756

Trending Articles