mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-12 18:56:11 +08:00
Add service methods to legacy ctx varialbe
This commit is contained in:
parent
6cb8d11b22
commit
946e345a3f
@ -2,8 +2,10 @@ package org.apache.cordova.api;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
@ -108,4 +110,22 @@ public class LegacyContext implements CordovaInterface {
|
|||||||
Log.i(LOG_TAG, "Replace ctx.getResources() with cordova.getActivity().getResources()");
|
Log.i(LOG_TAG, "Replace ctx.getResources() with cordova.getActivity().getResources()");
|
||||||
return this.cordova.getActivity().getResources();
|
return this.cordova.getActivity().getResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public ComponentName startService(Intent service) {
|
||||||
|
Log.i(LOG_TAG, "Replace ctx.startService() with cordova.getActivity().startService()");
|
||||||
|
return this.cordova.getActivity().startService(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean bindService(Intent service, ServiceConnection conn, int flags) {
|
||||||
|
Log.i(LOG_TAG, "Replace ctx.bindService() with cordova.getActivity().bindService()");
|
||||||
|
return this.cordova.getActivity().bindService(service, conn, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void unbindService(ServiceConnection conn) {
|
||||||
|
Log.i(LOG_TAG, "Replace ctx.unbindService() with cordova.getActivity().unbindService()");
|
||||||
|
this.cordova.getActivity().unbindService(conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user