Example of Webview Layouts and How to use in Android

clip_image002-176x300

What is WebView class?

The WebView class is a subclass of “android.view” class that facilitates to fetch external URL running in web server and display it in device’s screen. It is specifically useful for displaying dynamic contents from the web server application. However, it will show only the contents, not the features of a fully html based web browser functionality.

In the WebView app, we implemented following steps to display the web content on device and also enabling the app to upload file to the web page contents:

  1. Verify the availability of device’s network connection
  2. Add progress bar logic for on click event of hyper-link in web page
  3. Add ability to upload file from local file storage on device through webview.

The only Requirement is…

External website URL should have UI contents compatible with the android device’s screen resolution.

Example of xml for activity

[sourcecode]
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

android:id="@+id/webview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

[/sourcecode]

Example of Main Activity class

[sourcecode]1.MainClass.java
=======================
package com.webviewdemo;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.Toast;
public class MainClass extends Activity {

WebView webview;
ProgressDialog  progressBar;
ProgressBar progressBar1;
MainClass _activity;
AlertDialog alertDialog;
boolean loadingFinished = true;
boolean redirect = false;
private ValueCallback mUploadMessage;
private final static int FILECHOOSER_RESULTCODE = 1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progressBar = null;
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
_activity = this;
setContentView(R.layout.main );
webview = (WebView) findViewById( R.id.webview1 );
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setWebChromeClient(new WebChromeClient()
{
//The undocumented magic method override
//Eclipse will swear at you if you try to put @Override here
public void openFileChooser(ValueCallback uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
MainClass.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
}
});
if(checkInternetConnection(_activity)==true){
if(savedInstanceState==null)
webview.loadUrl("https://www.andolasoft.com/");
else
webview.loadUrl("https://www.andolasoft.com/");
alertDialog = new AlertDialog.Builder(this).create();
progressBar = ProgressDialog.show(MainClass.this, "Please wait…", "Loading…");
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) {
if (!loadingFinished) {
redirect = true;
}
loadingFinished = false;
webview.loadUrl(urlNewString);
return true;
}
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
handler.proceed() ;
}
@Override
public void onPageFinished(WebView view, String url) {
if(!redirect){
loadingFinished = true;
}
if(loadingFinished && !redirect){
//HIDE LOADING IT HAS FINISHED
if (progressBar != null && progressBar.isShowing()) {
progressBar.hide();
}
} else{
redirect = false;
}
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
loadingFinished = false;
progressBar.show();
}});
}
else{
AlertDialog.Builder builder = new AlertDialog.Builder(_activity);
builder.setMessage("Please check your network connection.")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});

AlertDialog alert = builder.create();
alert.show();
}
}

public static boolean checkInternetConnection(Activity _activity) {
ConnectivityManager conMgr = (ConnectivityManager) _activity.getSystemService(Context.CONNECTIVITY_SERVICE);
if (conMgr.getActiveNetworkInfo() != null
&& conMgr.getActiveNetworkInfo().isAvailable()
&& conMgr.getActiveNetworkInfo().isConnected())
return true;
else
return false;
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage)
return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;

}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK){
if(webview.canGoBack()){
webview.goBack();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}
[/sourcecode]

Example of User’s permission mentioned in androidmanifest.xml

[sourcecode]

[/sourcecode]

WebView is really helpful in creating quick Mobile UI without using complex Views/Layouts of Android. A HTML developer can easily build a web page with dynamic contents using CSS/HTML tags. Generally, we can run everything on WebView i.e., in android browser we can run jQuery, Flash enabled app while replicating the web based platform to mobile based smaller screen.

Benefits:

WebView are useful in following cases:

  • Since the web contents are dynamically updated at server side, the android app will display the updated contents just by fetching from site through WebView.
  • Web apps can be easily integrated to native application through WebView controls.

Why is CakePHP Popular For Web App Development

Web application development is a competitive field with new frameworks and tools emerging almost every day. If you are looking to create a dynamic website or web app, you may be wondering which framework will best suit your needs. When it comes to choosing the right technology for your project, there are many factors to consider. Below, we’ll review some of the benefits of using CakePHP  and why is CakePHP popular for web app development.

What is CakePHP?

CakePHP is a free and open-source platform, which facilitates the developers to build highly affordable web-applications using the MVC framework. This is a robust and efficient platform for the developers to create exciting PHP web applications.

What Makes CakePHP Popular?

Here I would like to discuss the aspects responsible for popularizing CakePHP among developers.

  • Easy-To-Use Functionality

    Developers are constantly looking for ways to make development process easier and hassle-free. Hence we can use code generation and scaffolding features built-in in CakePHP to rapidly build prototypes.

Never miss an update from us. Join 10,000+ marketers and leaders.

CakePHP facilitates this opportunity which adds to its popularity. With CakePHP, the application development is not burdened with writing complex codes for the application hence saves a lot of development time. The code lines are also simplified and reduced to facilitate the developers with productive development process.

  • Flexible And Versatile

    CakePHP is used for web app development is because the configuration is flexible and versatile. It can automatically cater itself based on the requirements of the developers and the changes made by them. Hence, it doesn’t require any elaborate configuration settings for project development. Most features and settings are auto detected in the system and require only the settings for database connections. It’s a feature rich light weight PHP framework comes with lot of features like code generation, translations, database access, caching, validation, authentication etc.

  • MVC (Model View Control) Architecture

    CakePHP development uses the model-view-control architecture which helps in distinguishing the business logic from data and design. It does a clear discrimination among the presentation layer, the business logic and database. It enables the developers to work independently on separate aspects of development at the same time. It enables the developers to develop faster and make optimum use of the resources.

  • Security

    The security of the application must be top notch such that they make the website full proof from any security breaches and is safe from the hands of hackers. CakePHP comes with built-in tools for input validation, CSRF protection, Form tampering protection, SQL injection prevention, and XSS prevention, helping you keep your application safe & secure. 

  • Friendly License

    CakePHP is licensed under the MIT license which makes it perfect for use in commercial applications.

CakePHP Development has become the foremost option for web developers as well as the Businesses to build exciting and unique applications. No wonder it is one of the most preferred MVC framework.

Planning something on CakePHP? Get in touch with Andolasoft’s Experts to discuss your idea.

Expected devices with Android 4.2 upgrades

android_jelly_been_123

Google’s Android 4.2 was released last October, which introduced numerous new features and enhancement for Jelly Bean OS platform. It included lock screen widgets and photo Sphere as well as new quick settings panel and screensaver function. For tablets, the upgrade included phone like user-interfaces and multi-user support

It has been nearly a year since the release of Samsung Galaxy Tab and apparently Samsung is planning to release an update to Android 4.1.2 first and then the final OTA Update with Android 4.2.2 Jelly Bean OS for the tablet. This will be the last official update from Samsung and hence further the users will have to rely on the Android development community for custom ROMs based on Android 5.0. The news first surfaced at ‘SamMobile’ and it seems like Samsung has fixed issues with Android 4.2.2 and Exynos CPU. Samsung will probably abandon updates for its former flagship tablet after the release of Jelly Bean 4.2.2 firmware update. These update i.e. Android 4.2.1 and 4.2.2 is expected to be available till September 2013. It is also rumored that Samsung devices with dual-core CPU will also receive Jelly Bean 4.2.2 updates.

There were other Galaxy Tab devices that are tested on Jelly Bean ROMs and its official release is expected by April 2013. The Jelly Bean OS is now tested on Galaxy Tab 10.1 GT 7500, Galaxy Tab GT 7300, Galaxy Tab 7.7 P6800 and the Galaxy Tab Plus P6200. These updates are yet to happen until Samsung decides to officially announce the release dates of OTA updates for Jelly Bean 4.2.2.

For Google’s nexus devices the upgrades are often early and directly from Google. Even carrier connected devices like the Verizon Galaxy Nexus are finally catching up, which generally experienced delays in update because of carrier interference. Asus gave Android 4.2 update to its Transformer Pad TF300 at the beginning of March and has said to release updates for Transformer Pad Infinity, MeMO Pad Smart and MeMO Pad, later this year. Sony has confirmed that it would release Android 4.2 upgrades for Xperia Z and Xperia Tablet Z devices. Motorola has also promised it would upgrade their Android OS for Motorola’s International Razr D1 and D3, but haven’t provided any definite timeline for the process.

Mobile device manufacturers are now willing to focus their Android Application Development efforts on Android 4.1 upgrade before heading to 4.2, because 4.2 is relatively a minor step from 4.1. Some companies are even considering to skip directly to the next major Android release i.e. Android Key Lime Pie, which is expected to be announced at Google’s I/O conference in May .

Android 4.2.2 brings minor updates for the Nexus users with improvements in Bluetooth audio issue

androidimg

Android’s latest 4.2.2 update is already released and beginning to roll out for its Nexus devices. This update will late be availed to other Mobile devices too. Since its last update i.e. Android 4.2.1 during the late November, 4.2.2 appears to have minor fixes only.

Android 4.2.2 update has primarily resolved the issue of audio streaming over Bluetooth that used to skip during the operation. Reddit user WeeManFoo quoted “Bluetooth streaming works better (compared to 4.2.1) but it’s not perfect” and mentioned that for other notable fixes or features to 4.2.2, users might have to wait for an official changelog.

WeeManFoo also referred that his Galaxy Nexus still gets disconnected from Bluetooth speakers when switching from Wi-Fi to a 3G data connection. So, it appears that there is still some work to be done by the android developers.

Google has also modified the new ‘Quick Settings panel’ introduced in Android 4.2.2. The Wi-Fi and Bluetooth icons in the panel can now be turned OFF and ON by long-pressing the icons, instead of browsing to their respective settings panels.

Google has also introduced a notification sound for wireless charging and has changed the notification sound that indicates that the phone or tablet’s battery is running low.

None of these are major changes, but they sure bring the refinements that we expect from a minor update. Android 4.2.2 continues to roll out to Galaxy Nexus, Nexus 7, and Nexus 10 devices however Nexus 4 users will have to wait for now.

At Andolasoft we develop unique android mobile applications for individuals and from start-ups to established companies. We’ve an expertise team of android app developers who design the most innovative apps for all android devices.

Android 4.2.2 is set for release this month!

androidimg

Google is constantly working to roll out its Jelly Bean update in the form of Android 4.2.2 in the end of this month. It is likely to be a minor update that will fix the prevalent bugs and to enhance the performance speed of the Jelly Bean OS. It is also expected to patch the Bluetooth streaming issue in Nexus 7 devices.

Some reports suggested that, Google is already testing the 4.2.2 update on all Nexus devices like the Nexus 4, Nexus7 and Nexus 10. According to the website, Google claims to release it to the consumers by mid-February. These rumors have been there for quite some time since the last couple of months but reporters have already spotted some Google Nexus 4 devices in Malaysia and Brazil that were running Android 4.2.2.

Rumors have it, that Google will be releasing its next Android version 5.0 in-between April and June of this year. This update may also be called as ‘Key Lime Pie’. Google has announced that its next developer conference will take place during May 15 to May 17 of 2013, where they might introduce new android applications for version 5.0. Finally, as only 1.2 % of Android devices run 4.2 Jelly Bean versions, only a few users would be benefited from this update.

At Andolasoft we develop the most intriguing android applications for our customers. We have a pool of expertise android developers to provide innovative solutions for all versions of android operating software.

Top Things You Need to Know About Cloud Services

 

Cloud service is a rapidly developing technology which is still in its infant stage. With such a recently developed technology it becomes tough for the industries to be in sync with its advancements.

So for successful cloud solutions, the company must construct a business strategy to be in parallel with the latest development in cloud computing technology, such as from the storage and extension to disaster recovery. Cloud technology therefore has brought new challenges for the IT as well as retail industries.

In order to meet these challenges, the companies should revise their skills to retain a competitive edge. They should also bring fewer in-house IT technicians.

This can be made simpler with the help of major cloud management service providers like Amazon, Rackspace etc.There are numerous cloud platforms available, but the industries should opt for an option that meets the specific needs of their business. SaaS (Software as a service) cloud service can be a viable alternative for both IT and retail industries.

Understanding Cloud Services

At its core, a cloud service refers to any computing resource or capability that is delivered over the internet. 

Instead of relying on local infrastructure, organizations can access and utilize these resources remotely. 

Cloud services encompass a wide range of offerings, each catering to specific business needs and technical requirements.

Cloud Service Models:

Infrastructure as a Service (IaaS): 

IaaS provides virtualized computing resources over the internet. This includes virtual machines, storage, and networking components.

Users have the flexibility to manage and control the operating systems and applications running on these virtualized resources.

Platform as a Service (PaaS): 

PaaS delivers a platform that enables developers to build, deploy, and manage applications without the complexities of managing the underlying infrastructure.

It offers a streamlined environment for coding, testing, and deploying applications.

Software as a Service (SaaS): 

SaaS delivers fully functional applications over the internet on a subscription basis. Users can access SaaS software applications without the need for installation, as everything is hosted in the cloud.

Examples include email services, customer relationship management (CRM) software, and productivity suites.

Benefits of Cloud Services:

  • Scalability:
    Cloud services allow businesses to scale resources up or down based on demand, ensuring optimal performance without overprovisioning.
  • Cost Efficiency:
    Organizations can avoid upfront infrastructure costs by paying only for the resources they consume. This cost-effective approach is particularly beneficial for startups and small businesses.
  • Accessibility:
    Cloud services enable remote access to resources, facilitating collaboration among teams spread across different locations.
  • Security and Compliance:
    Reputable cloud service providers offer
    robust security measures and compliance certifications, often surpassing what individual businesses can achieve.
  • Backup and Disaster Recovery:
    Cloud services offer automated backup and disaster recovery solutions, minimizing data loss and downtime.

Practical Applications of Cloud Services

Cloud services have revolutionized various industries, offering innovative solutions to age-old challenges. Here are some practical applications:

  • E-Commerce:
    Cloud services provide the scalability and reliability needed to handle fluctuating online shopping demands.
  • Healthcare:
    Cloud services facilitate secure storage and sharing of patient data, enabling seamless collaboration among healthcare professionals.
  • Education:
    Cloud-based learning management systems (LMS) enhance remote education by providing a centralized platform for course materials, assignments, and communication.
  • FinTech:
    Cloud services offer the computational power required for complex financial analytics and algorithmic trading.
  • Entertainment:
    Streaming services rely on cloud infrastructure to deliver content to millions of users simultaneously.

Challenges and Considerations

While cloud services offer numerous benefits, it’s essential to be aware of potential challenges:

  • Security Concerns:
    Storing sensitive data on remote servers raises security and privacy concerns. Encryption and proper access controls are crucial.
  • Vendor Lock-In:
    Migrating between different cloud service providers can be complex and costly, potentially leading to vendor lock-in.
  • Downtime:
    Relying on external infrastructure means being vulnerable to outages and downtime caused by the cloud provider.
  • Data Transfer Costs:
    Transmitting large amounts of data to and from the cloud can result in unexpected expenses.

Choosing the Right Cloud Service Provider

When selecting a cloud service provider, consider factors such as reliability, security measures, compliance certifications, pricing structure, and customer support. Popular options include Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), and IBM Cloud.

At Andolasoft, we provide cloud management and support service with our highly experienced infrastructure experts. We provide proactive maintenance, monitoring, server support, backup and recovery services. We have executed numerous tasks based on our customer’s business requirements successfully.

Planning anything on Cloud? Andolasoft provides Best-in-Class Cloud Management Services for Businesses of all kinds. Let’s have a quick discussion.