It is made using namespace js pattern. You can see result of test as json format
Another useful snippet HTML5 hybrid app for Android, using the method addJavascriptInterface to send sms:
// sms permission in your manifest file of Android project// start code @SuppressLint({"SetJavaScriptEnabled","JavascriptInterface"}) public class MainActivity extends Activity { public WebView webView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // source activity_main.xml webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(new WebAppInterface(this), "Android"); webView.setWebViewClient(new WebViewClient()); // important set Web Chrome Client webView.setWebChromeClient(new WebChromeClient()); webView.loadUrl(url); //local or remote } // final class for save and write file in external storage final class WebAppInterface { Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Built-in SMS application */ public void sendBSMS(String contentsms, String tag) { try { Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", contentsms); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent); } catch (IOException e) { Log.e(tag, "Action failed: " + e.toString()); } } /** *Send with SmsManager API */ public void sendSMSM(String phoneNo, String contentsms, String tag) { try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNo, null, contentsms, null, null); } catch (IOException e) { Log.e(tag, "SMS failed: " + e.toString()); } } } } // Now open html file in www folder * optional * ...
Ho riprogettato il mio plugin in jQuery per la lettura delle fonti RSS e ho incluso anche la possibilità di prelevare i feeds dai più celebri social network con due opzioni di animazione dei post: scroller e rotate. Puoi inoltre impaginare i feeds escludendo le animazioni e regolare il numero massimo di post che desideri mostrare ai tuoi utenti, nascondere la data di pubblicazione e infine, per i feeds di facebook, puoi settare in un unico parametro l’App ID e l’App key necessari per autorizzare il tuo server a connettersi con il tuo profilo e pubblicare tutti i tuoi aggiornamenti. Per una corretta integrazione del componente nel tuo sito clicca quì