mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-01 16:51:16 +00:00
Moved native syncthing library into background thread.
This commit is contained in:
parent
0b075eb60e
commit
9dfa635bed
3 changed files with 36 additions and 4 deletions
|
@ -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>
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
26
src/com/nutomic/syncthingandroid/SyncthingService.java
Normal file
26
src/com/nutomic/syncthingandroid/SyncthingService.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue