Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
import static com.bmi.bmitestapp.CommonUtilities.DISPLAY_MESSAGE_ACTION; import static com.bmi.bmitestapp.CommonUtilities.EXTRA_MESSAGE; import static com.bmi.bmitestapp.CommonUtilities.SENDER_ID; import java.io.File; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.TextView; import android.widget.Toast; import android.webkit.*; import com.google.android.gcm.GCMRegistrar; public class MainActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); // label to display gcm messages TextView lblMessage; WebView webView; // Asyntask AsyncTask mRegisterTask; // Alert dialog manager AlertDialogManager alert = new AlertDialogManager(); // Connection detector ConnectionDetector cd; public static String name; public static String email; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.e(TAG, "in onCreate in mainactivity"); cd = new ConnectionDetector(getApplicationContext()); // Check if Internet present // if (!cd.isConnectingToInternet()) { // // Internet Connection is not present // alert.showAlertDialog(MainActivity.this, // "Internet Connection Error", // "Please connect to working Internet connection", false); // // stop executing code by return // return; // } // Getting name, email from intent Intent i = getIntent(); name = i.getStringExtra("name"); email = i.getStringExtra("email"); // Make sure the device has the proper dependencies. GCMRegistrar.checkDevice(this); // Make sure the manifest was properly set - comment out this line // while developing the app, then uncomment it when it's ready. GCMRegistrar.checkManifest(this); lblMessage = (TextView) findViewById(R.id.lblMessage); registerReceiver(mHandleMessageReceiver, new IntentFilter( DISPLAY_MESSAGE_ACTION)); // Get GCM registration id final String regId = GCMRegistrar.getRegistrationId(this); // Check if regid already presents if (regId.equals("")) { // Registration is not present, register now with GCM GCMRegistrar.register(this, SENDER_ID); } else { // Device is already registered on GCM if (GCMRegistrar.isRegisteredOnServer(this)) { // Skips registration. Toast.makeText(getApplicationContext(), "Already registered with GCM", Toast.LENGTH_LONG).show(); } else { // Try to register again, but not in the UI thread. // It's also necessary to cancel the thread onDestroy(), // hence the use of AsyncTask instead of a raw thread. final Context context = this; mRegisterTask = new AsyncTask() { @Override protected Void doInBackground(Void... params) { // Register on our server // On server creates a new user ServerUtilities.register(context, name, email, regId); return null; } @Override protected void onPostExecute(Void result) { mRegisterTask = null; } }; mRegisterTask.execute(null, null, null); } } webView = (WebView)findViewById(R.id.webView1); // Initialize the WebView webView.getSettings().setSupportZoom(true); webView.getSettings().setBuiltInZoomControls(true); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setDomStorageEnabled(true); // Set cache size to 8 mb by default. should be more than enough webView.getSettings().setAppCacheMaxSize(1024*1024*8); // This next one is crazy. It's the DEFAULT location for your app's cache // But it didn't work for me without this line. // UPDATE: no hardcoded path. Thanks to Kevin Hawkins String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); Log.e(TAG, "appCachePath = " + appCachePath); webView.getSettings().setAppCachePath(appCachePath); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setAppCacheEnabled(true); // Load the URLs inside the WebView, not in the external web browser webView.setWebViewClient(new WebViewClient()); if (savedInstanceState == null) { if(isNetworkAvailable() == true){ Log.e(TAG, "we have a network connection"); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); webView.loadUrl("http://bmi.cubecore.co.uk"); } else { Log.e(TAG, "we don't have a network connection"); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); webView.loadUrl("http://bmi.cubecore.co.uk"); } } } //end of oncreate private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null; } /** * Receiving push messages * */ private final BroadcastReceiver mHandleMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String newMessage = intent.getExtras().getString(EXTRA_MESSAGE); // Waking up mobile if it is sleeping WakeLocker.acquire(getApplicationContext()); /** * Take appropriate action on this message * depending upon your app requirement * For now i am just displaying it on the screen * */ // Showing received message lblMessage.append(newMessage + "\n"); Toast.makeText(getApplicationContext(), "New Message: " + newMessage, Toast.LENGTH_LONG).show(); // Releasing wake lock WakeLocker.release(); } }; @Override protected void onDestroy() { super.onDestroy(); // Clear the cache (this clears the WebViews cache for the entire application) //webView.clearCache(false); if (mRegisterTask != null) { mRegisterTask.cancel(true); } try { unregisterReceiver(mHandleMessageReceiver); GCMRegistrar.onDestroy(this); } catch (Exception e) { Log.e("UnRegister Receiver Error", "> " + e.getMessage()); } } @Override public void onBackPressed() { super.onBackPressed(); } @Override protected void onResume() { super.onResume(); Log.e(TAG, "in onResume in mainactivity"); } @Override public File getCacheDir() { // NOTE: this method is used in Android 2.1 Log.e(TAG, "getcachedir"); return getApplicationContext().getCacheDir(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save the state of the WebView webView.saveState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); // Restore the state of the WebView webView.restoreState(savedInstanceState); } }