Return to main page CryptoStorageServiceStarter
1: package com.voipplus.mmsclient.serviceLocalStorage;
2:
3: import android.content.ComponentName;
4: import android.content.Context;
5: import android.content. ;
6: import android.content.ServiceConnection;
7: import android.os.IBinder;
8: import android.util.Log;
9:
10: public class CryptoStorageServiceStarter {
11: private static final String TAG = "CryptoStorageServiceStarter";
12: private CryptoStorageService cryptoStorageService;
13: private boolean isBound = false;
14: private Context context;
15: private ServiceConnectionCallback listener;
16:
17: public interface ServiceConnectionCallback {
18: void onCryptoStorageServiceConnected(CryptoStorageService service);
19: }
20:
21: public CryptoStorageServiceStarter(Context context, ServiceConnectionCallback listener) {
22: this.context = context;
23: this.listener = listener;
24: }
25:
26: private ServiceConnection connection = new ServiceConnection() {
27: @Override
28: public void onServiceConnected(ComponentName className, IBinder service) {
29: CryptoStorageService.LocalBinder binder = (CryptoStorageService.LocalBinder) service;
30: cryptoStorageService = binder.getService();
31: isBound = true;
32: Log.d(TAG, "CryptoStorageService connected");
33: if (listener != null) {
34: listener.onCryptoStorageServiceConnected(cryptoStorageService);
35: }}
36:
37: @Override
38: public void onServiceDisconnected(ComponentName arg0) {
39: isBound = false;
40: Log.d(TAG, "CryptoStorageService disconnected");
41: }
42: };
43:
44: public void bind() {
45: intent = new (context, CryptoStorageService.class);
46: context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
47: }
48:
49: public void unbind() {
50: if (isBound) {
51: context.unbindService(connection);
52: isBound = false;
53: }
54: }
55: public void startAndBindService() {
56: intent = new (context, CryptoStorageService.class);
57: context.startService(intent);
58: context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
59: }
60: }
61:
Return to main page
AndroidMosaic context:
- 2025 year: Resolve class conflicts #AndroidMosaic
- 2025 year: Application level parameters in configuration #AndroidMosaic
- 2025 year: Create test with junit and pass or dismiss test before application launch #AndroidMosaic
- 2025 year: Ask special permission and listen answer #AndroidMosaic
- 2025 year: Service lifecycle #AndroidMosaic
- 2025 year: AtomicInteger and accept service callback in UI thread, stop progressBar that was run in UiThread #AndroidMosaic
- 2025 year: Generate random data and pass it to RecyclerView with Adapter #AndroidMosaic
- 2025 year: Pass data to new form with Intent and getParcelableExtra #AndroidMosaic
- 2025 year: Access to Contact list #AndroidMosaic
- 2025 year: Using Query and Cursor to read data sequence and fill DataAdapter for RecyclerView #AndroidMosaic
- 2025 year: Custom TabSwithcer #AndroidMosaic
- 2025 year: Custom Dropdownlist with default value based on Spinner #AndroidMosaic
- 2025 year: Create MMS service and route MMS to Emulator #AndroidMosaic
- 2025 year: Vector drawable - fastest way to create icons #AndroidMosaic
- 2025 year: Technique to create Button with own rectangle shape #AndroidMosaic
- 2025 year: Simple HTTP service #AndroidMosaic
- 2025 year: Simple key-value service with Local Storage #AndroidMosaic
- 2025 year: Cryptographic local storage key-value service #AndroidMosaic
- 2025 year: WebRTC service #AndroidMosaic
- 2025 year: SIP service #AndroidMosaic
- 2025 year: Global objects with references to all application services #AndroidMosaic
Comments (
)

Link to this page:
http://www.vb-net.com/AndroidMosaic/CryptoStorageServiceStarter.htm
|