我在我的项目中使用cordova,我想访问一些网址。 我有一个扩展CordovaActivity类的类。在myclass中,当cordova构建项目时,onCreate()函数将自动添加到myClass。每当cordova构建项目时,都会生成此类。 我的问题是,当我运行cordova构建时,我的新代码将永远消失在该类中。我还在GCMIntentService类的创建Notificatio函数中使用了这个类。
有关我应该在哪里添加新代码以访问网址的任何想法吗?
这是我的代码:
public class Myclass extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
super.loadUrl(Config.getStartUrl());
}
// here is my new code that intend to loud a specific page
@Override
public void onResume() {
super.onResume();
String url = Config.getStartUrl();
Intent intent = getIntent();
if (intent != null) {
String s = intent.getStringExtra("HTML_PAGE");
if (s != null) url = s;
}
super.loadUrl(url);
}
// here is my new code
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
}