【发布时间】:2020-01-21 17:21:13
【问题描述】:
我想开始一项活动,但很奇怪,我找不到一个地方可以告诉我应该在哪里做。
这是我的代码:
@Override public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
Intent service = new Intent(getApplicationContext(), MyTaskService.class); Bundle bundle = new Bundle();
bundle.putString("foo", "bar"); service.putExtras(bundle);
getApplicationContext().startService(service);
}
【问题讨论】:
-
根据您的代码,您正在尝试从 oncreate 启动服务。您能否用您的代码 sn-p 详细解释您的查询。
-
@Rizwan 我正在尝试在 React-Native 中实现 Headless JS,这也需要对 Adnroid 本机代码进行一些更改
标签: java android start-activity