1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-29 07:41:17 +00:00

Moved native syncthing library into background thread.

This commit is contained in:
Felix Ableitner 2014-05-05 23:21:55 +02:00
parent 0b075eb60e
commit 9dfa635bed
3 changed files with 36 additions and 4 deletions

View file

@ -11,8 +11,9 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" > <application android:label="@string/app_name" >
<activity <activity
android:name="MainActivity" android:name=".MainActivity"
android:theme="@android:style/Theme.Holo.Light" android:theme="@android:style/Theme.Holo.Light"
android:label="@string/app_name" > android:label="@string/app_name" >
<intent-filter> <intent-filter>
@ -20,5 +21,8 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name=".SyncthingService" />
</application> </application>
</manifest> </manifest>

View file

@ -1,15 +1,17 @@
package com.nutomic.syncthingandroid; package com.nutomic.syncthingandroid;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
public class MainActivity extends Activity { public class MainActivity extends Activity {
private static final String TAG = "MainActivity"; private static final String TAG = "MainActivity";
@Override public void onCreate(Bundle savedInstanceState) { @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
System.loadLibrary("syncthing"); startService(new Intent(this, SyncthingService.class));
} }
} }

View file

@ -0,0 +1,26 @@
package com.nutomic.syncthingandroid;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
public class SyncthingService extends Service {
private static final String TAG = "SyncthingService";
@Override
public void onCreate() {
new Thread(new Runnable() {
@Override
public void run() {
System.loadLibrary("syncthing");
}
}).start();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}