Java tutorial
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.ionicframework.mobile649514; import android.content.Intent; import android.os.Bundle; import android.util.Log; import org.apache.cordova.*; public class mobile extends CordovaActivity { public static boolean inApp = false; public static mobile cordovaActivity; public static String url = "#/menu/map"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("yunan", "oncreate"); String extraUrl = getIntent().getStringExtra("url"); if (extraUrl != null) { Log.e("yunan", extraUrl); url = extraUrl; } cordovaActivity = this; super.init(); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); //super.loadUrl("file:///android_asset/www/index.html"); } @Override public void onNewIntent(Intent newIntent) { this.setIntent(newIntent); Log.e("yunan", "new intent"); String extraMsg = newIntent.getStringExtra("message"); String extraUrl = newIntent.getStringExtra("url"); if (extraMsg != null) { Log.e("yunan", "on new intent " + extraMsg); this.sendJavascript("javascript:callFromJava('" + extraUrl + "')"); } // Now getIntent() returns the updated Intent // isNextWeek = getIntent().getBooleanExtra(IS_NEXT_WEEK, false); } @Override protected void onPause() { super.onPause(); Log.e("yunan", "on pause"); inApp = false; } @Override protected void onResume() { super.onResume(); Log.e("yunan", "on resume"); inApp = true; } }