b0767d6987b2773786a66e42728801a3bc73bd04
1 /* This file is part of NIT ( http://www.nitlanguage.org ).
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
18 import android
.app
.Service
;
19 import android
.content
.Intent
;
20 import android
.os
.IBinder
;
22 // Service implemented in Nit
23 public class NitService
extends Service
{
25 protected int nitService
= 0;
28 System
.loadLibrary("nit_app");
32 public int onStartCommand(Intent intent
, int flags
, int id
) {
33 return nitOnStartCommand(nitService
, intent
, flags
, id
);
37 public void onCreate() {
38 nitService
= nitNewService();
39 nitOnCreate(nitService
);
44 public void onDestroy() {
45 nitOnDestroy(nitService
);
50 public IBinder
onBind(Intent arg
) {
54 protected native int nitNewService();
55 protected native int nitOnStartCommand(int nitService
, Intent intent
, int flags
, int id
);
56 protected native void nitOnCreate(int nitService
);
57 protected native void nitOnDestroy(int nitService
);