本文整理汇总了Java中com.codename1.impl.android.AndroidNativeUtil类的典型用法代码示例。如果您正苦于以下问题:Java AndroidNativeUtil类的具体用法?Java AndroidNativeUtil怎么用?Java AndroidNativeUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidNativeUtil类属于com.codename1.impl.android包,在下文中一共展示了AndroidNativeUtil类的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: say
点赞 3
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void say(final String param) {
if(ttobj == null) {
ttobj = new TextToSpeech(AndroidNativeUtil.getActivity(),
new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
ttobj.setLanguage(Locale.UK);
ttobj.speak(param, TextToSpeech.QUEUE_FLUSH, null);
}
}
});
return;
}
ttobj.speak(param, TextToSpeech.QUEUE_FLUSH, null);
}
开发者ID:codenameone,
项目名称:codenameone-demos,
代码行数:17,
代码来源:TTSImpl.java
示例2: init
点赞 3
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public static void init() {
FacebookConnect.implClass = FacebookImpl.class;
permissions = new ArrayList<String>();
String permissionsStr = Display.getInstance().getProperty("facebook_permissions", "");
permissionsStr = permissionsStr.trim();
StringTokenizer token = new StringTokenizer(permissionsStr, ", ");
if (token.countTokens() > 0) {
try {
while (token.hasMoreElements()) {
String permission = (String) token.nextToken();
permission = permission.trim();
permissions.add(permission);
}
} catch (Exception e) {
//the pattern is not valid
}
}
FacebookSdk.sdkInitialize(AndroidNativeUtil.getContext().getApplicationContext());
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:23,
代码来源:FacebookImpl.java
示例3: askPublishPermissions
点赞 3
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void askPublishPermissions(final LoginCallback cb) {
if (AndroidNativeUtil.getActivity() == null) {
throw new RuntimeException("Cannot ask for publish permissions when running in the background.");
}
if (loginLock) {
return;
}
loginLock = true;
LoginManager login = LoginManager.getInstance();
final CallbackManager mCallbackManager = CallbackManager.Factory.create();
final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity();
activity.setIntentResultListener(new IntentResultListener() {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mCallbackManager.onActivityResult(requestCode, resultCode, data);
activity.restoreIntentResultListener();
}
});
login.registerCallback(mCallbackManager, new FBCallback(cb));
login.logInWithPublishPermissions(activity, PUBLISH_PERMISSIONS);
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:25,
代码来源:FacebookImpl.java
示例4: initialize
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void initialize(String apiEndPoint, String applicationId, String clientKey) {
String endPoint = apiEndPoint;
if (endPoint != null && !endPoint.endsWith("/")) {
endPoint += "/"; // Note: Url needs to have a trailing slash
}
Parse.initialize(new Parse.Configuration.Builder(AndroidNativeUtil.getActivity())
.applicationId(applicationId)
.clientKey(clientKey)
.server(endPoint)
.build()
);
}
开发者ID:sidiabale,
项目名称:parse4cn1,
代码行数:14,
代码来源:ParseInstallationNativeImpl.java
示例5: onCreate
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// Parse native SDK should be initialized in the application class
// and not in the activity otherwise push notifications will only be received
// when the application is running (which is generally undesirable).
//
// See: http://stackoverflow.com/questions/26637730/where-to-place-the-parse-initialize
// and https://parse.com/questions/cannot-send-push-to-android-after-app-is-closed-until-screen-unlock
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("OiTzm1ivZovdmMktQnqk8ajqBVIPgl4dlgUxw4dh")
.clientKey("fHquv9DA0SA5pd7VPO38tNzOrzrgTgfd7yY3nXbo")
.server("https://parseapi.back4app.com")
.build()
);
// Creates a unique installation representing the given device
// and persists it to the Parse backend.
// Without an installation, a device cannot be targeted for push notifications.
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
@Override
public void done(com.parse.ParseException error) {
if (error == null) {
ParsePush.handlePushRegistrationStatus(null, 0); // success
} else {
ParsePush.handlePushRegistrationStatus(error.getMessage(), 3); // saving installation related failure
}
}
}
);
// Tracks the application state so that pushes can be handled according to the
// state.
initializeLifecycleListener();
AndroidNativeUtil.addLifecycleListener(lifecycleListener);
}
开发者ID:sidiabale,
项目名称:parse4cn1,
代码行数:38,
代码来源:CN1AndroidApplication.java
示例6: loadInterstitial
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void loadInterstitial()
{
_("loadInterstitial()");
selfContext=AndroidNativeUtil.getActivity();
AerServConfig config = new AerServConfig(selfContext, getPlc()).setKeywords(keywords).setEventListener(listener).setDebug(true).setVerbose(true);
interstitial = new AerServInterstitial(config);
interstitial.show();
}
开发者ID:amiga,
项目名称:aerserv-codenameone-testbed,
代码行数:9,
代码来源:MyNativeImpl.java
示例7: showBanner
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void showBanner() {
selfContext=AndroidNativeUtil.getActivity();
_("GAZ REMOVED THIS FOR NOW.");
// final AerServConfig config = new AerServConfig(selfContext, getPlc()).setKeywords(keywords).setEventListener(listener).setDebug(true).setRefreshInterval(60).setVerbose(true);
// banner = (AerServBanner) findViewById(R.id.banner);
// banner.configure(config).show();
}
开发者ID:amiga,
项目名称:aerserv-codenameone-testbed,
代码行数:8,
代码来源:MyNativeImpl.java
示例8: onConnectionFailed
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void onConnectionFailed(final ConnectionResult cr) {
if (AndroidNativeUtil.getActivity() == null) {
return;
}
final CodenameOneActivity main = (CodenameOneActivity) AndroidNativeUtil.getActivity();
if (!mIntentInProgress && cr.hasResolution()) {
try {
mIntentInProgress = true;
main.startIntentSenderForResult(cr.getResolution().getIntentSender(),
0, null, 0, 0, 0);
main.setIntentResultListener(new com.codename1.impl.android.IntentResultListener() {
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
mIntentInProgress = false;
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
main.restoreIntentResultListener();
}
});
} catch (SendIntentException e) {
// The intent was canceled before it was sent. Return to the default
// state and attempt to connect to get an updated ConnectionResult.
mIntentInProgress = false;
mGoogleApiClient.connect();
}
return;
}
if (callback != null) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
callback.loginFailed(GooglePlayServicesUtil.getErrorString(cr.getErrorCode()));
}
});
}
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:41,
代码来源:GoogleImpl.java
示例9: clearListener
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
protected void clearListener() {
final Class bgListenerClass = getBackgroundLocationListener();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//mGoogleApiClient must be connected
while (!getmGoogleApiClient().isConnected()) {
try {
Thread.sleep(300);
} catch (Exception ex) {
}
}
Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.post(new Runnable() {
public void run() {
if (inMemoryBackgroundLocationListener != null) {
Context context = AndroidNativeUtil.getContext();
Intent intent = new Intent(context, BackgroundLocationHandler.class);
if (bgListenerClass != null) {
intent.putExtra("backgroundClass", bgListenerClass.getName());
}
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
LocationServices.FusedLocationApi.removeLocationUpdates(getmGoogleApiClient(), pendingIntent);
inMemoryBackgroundLocationListener = null;
} else {
LocationServices.FusedLocationApi.removeLocationUpdates(getmGoogleApiClient(), AndroidLocationPlayServiceManager.this);
}
}
});
}
});
t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler);
t.start();
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:41,
代码来源:AndroidLocationPlayServiceManager.java
示例10: clearBackgroundListener
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
protected void clearBackgroundListener() {
final Class bgListenerClass = getBackgroundLocationListener();
if (bgListenerClass == null) {
return;
}
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//mGoogleApiClient must be connected
while (!getmGoogleApiClient().isConnected()) {
try {
Thread.sleep(300);
} catch (Exception ex) {
}
}
Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.post(new Runnable() {
public void run() {
Context context = AndroidNativeUtil.getContext().getApplicationContext();
Intent intent = new Intent(context, BackgroundLocationHandler.class);
intent.putExtra("backgroundClass", bgListenerClass.getName());
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
LocationServices.FusedLocationApi.removeLocationUpdates(getmGoogleApiClient(), pendingIntent);
}
});
}
});
t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler);
t.start();
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:37,
代码来源:AndroidLocationPlayServiceManager.java
示例11: getmGoogleApiClient
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
/**
* @return the mGoogleApiClient
*/
private GoogleApiClient getmGoogleApiClient() {
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(AndroidNativeUtil.getContext())
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
if (!mGoogleApiClient.isConnected()) {
mGoogleApiClient.connect();
}
}
return mGoogleApiClient;
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:18,
代码来源:AndroidLocationPlayServiceManager.java
示例12: getInstance
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
private GoogleAnalytics getInstance() {
if(analytics == null){
analytics = GoogleAnalytics.getInstance(AndroidNativeUtil.getActivity());
}
return analytics;
}
开发者ID:Pmovil,
项目名称:cn1libs-native-ga,
代码行数:7,
代码来源:GANativeInterfaceImpl.java
示例13: initialize
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void initialize(String trackingId) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(AndroidNativeUtil.getActivity());
peer = analytics.newTracker(trackingId);
}
开发者ID:Pmovil,
项目名称:cn1libs-native-ga,
代码行数:5,
代码来源:TrackerNativeInterfaceImpl.java
示例14: onTerminate
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
public void onTerminate() {
AndroidNativeUtil.removeLifecycleListener(lifecycleListener);
super.onTerminate();
}
开发者ID:sidiabale,
项目名称:parse4cn1,
代码行数:6,
代码来源:CN1AndroidApplication.java
示例15: createNativeButton
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public android.view.View createNativeButton(String param) {
Activity activity = AndroidNativeUtil.getActivity();
android.widget.Button b = new android.widget.Button(activity);
b.setText(param);
return b;
}
开发者ID:codenameone,
项目名称:codenameone-demos,
代码行数:7,
代码来源:NativeCallsImpl.java
示例16: preloadInterstitial
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
public void preloadInterstitial() {
selfContext=AndroidNativeUtil.getActivity();
final AerServConfig config = new AerServConfig(selfContext, getPlc()).setKeywords(keywords).setEventListener(listener).setDebug(true).setPreload(true);
interstitial = new AerServInterstitial(config);
}
开发者ID:amiga,
项目名称:aerserv-codenameone-testbed,
代码行数:6,
代码来源:MyNativeImpl.java
示例17: getClient
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
private GoogleApiClient getClient(SuccessCallback<GoogleApiClient> onConnected) {
if (mGoogleApiClient == null) {
Context ctx = AndroidNativeUtil.getContext();
if (mGoogleApiClient == null) {
GoogleSignInOptions gso;
if (clientId != null && clientSecret != null) {
System.out.println("Generating GoogleSignIn for clientID="+clientId);
List<Scope> includeScopes = new ArrayList<Scope>();
Scope firstScope = new Scope(Scopes.PROFILE);
if (scope != null) {
for (String str : Util.split(scope, " ")) {
if ("profile".equals(str)) {
//str = Scopes.PROFILE;
continue;
} else if ("email".equals(str)) {
str = Scopes.EMAIL;
} else if (Scopes.PROFILE.equals(str)) {
continue;
}
if (str.trim().isEmpty()) {
continue;
}
includeScopes.add(new Scope(str.trim()));
}
}
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
//.requestIdToken("555462747934-iujpd5saj4pjpibo7c6r9tbjfef22rh1.apps.googleusercontent.com")
.requestIdToken(clientId)
.requestScopes(firstScope, includeScopes.toArray(new Scope[includeScopes.size()]))
//.requestScopes(Plus.SCOPE_PLUS_PROFILE)
//.requestServerAuthCode("555462747934-iujpd5saj4pjpibo7c6r9tbjfef22rh1.apps.googleusercontent.com")
.requestServerAuthCode(clientId)
.build();
} else {
System.out.println("Generating GoogleSignIn without ID token");
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).build();
}
mGoogleApiClient = new GoogleApiClient.Builder(ctx)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
}
}
if (mGoogleApiClient.isConnected()) {
if (onConnected != null) {
onConnected.onSucess(mGoogleApiClient);
}
} else {
synchronized(onConnectedCallbacks) {
if (onConnected != null) {
onConnectedCallbacks.add(onConnected);
}
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect(GoogleApiClient.SIGN_IN_MODE_OPTIONAL);
}
}
}
return mGoogleApiClient;
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:62,
代码来源:GoogleImpl.java
示例18: inviteFriends
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
public void inviteFriends(String appLinkUrl, String previewImageUrl, final Callback cb) {
if (AndroidNativeUtil.getActivity() == null) {
throw new RuntimeException("Cannot invite friends while running in the background.");
}
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity();
if(cb == null){
AppInviteDialog.show(activity, content);
}else{
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
final CallbackManager mCallbackManager = CallbackManager.Factory.create();
activity.setIntentResultListener(new IntentResultListener() {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mCallbackManager.onActivityResult(requestCode, resultCode, data);
activity.restoreIntentResultListener();
}
});
appInviteDialog.registerCallback(mCallbackManager, new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onSucess(null);
}
});
}
@Override
public void onCancel() {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onError(null, null, -1, "User Cancelled");
}
});
}
@Override
public void onError(final FacebookException e) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onError(null, e, 0, e.getMessage());
}
});
}
});
appInviteDialog.show(content);
}
}
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:64,
代码来源:FacebookImpl.java
示例19: bindListener
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
protected void bindListener() {
final Class bgListenerClass = getBackgroundLocationListener();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//wait until the client is connected, otherwise the call to
//requestLocationUpdates will fail
while (!getmGoogleApiClient().isConnected()) {
try {
Thread.sleep(300);
} catch (Exception ex) {
}
}
Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.post(new Runnable() {
public void run() {
LocationRequest r = locationRequest;
com.codename1.location.LocationRequest request = getRequest();
if (request != null) {
LocationRequest lr = LocationRequest.create();
if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_HIGH_ACCUARCY) {
lr.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
} else if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_MEDIUM_ACCUARCY) {
lr.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
} else {
lr.setPriority(LocationRequest.PRIORITY_LOW_POWER);
}
lr.setInterval(request.getInterval());
r = lr;
}
if (AndroidImplementation.getActivity() == null) {
// we are in the background
// Sometimes using regular locations in the background causes a crash
// so we need to use the pending intent version.
Context context = AndroidNativeUtil.getContext();
Intent intent = new Intent(context, BackgroundLocationHandler.class);
//there is an bug that causes this to not to workhttps://code.google.com/p/android/issues/detail?id=81812
//intent.putExtra("backgroundClass", getBackgroundLocationListener().getName());
//an ugly workaround to the putExtra bug
if (bgListenerClass != null) {
intent.setData(Uri.parse("http://codenameone.com/a?" + bgListenerClass.getName()));
}
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
inMemoryBackgroundLocationListener = AndroidLocationPlayServiceManager.this;
LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, pendingIntent);
} else {
LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, AndroidLocationPlayServiceManager.this);
}
}
});
}
});
t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler);
t.start();
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:65,
代码来源:AndroidLocationPlayServiceManager.java
示例20: bindBackgroundListener
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
protected void bindBackgroundListener() {
final Class bgListenerClass = getBackgroundLocationListener();
if (bgListenerClass == null) {
return;
}
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//wait until the client is connected, otherwise the call to
//requestLocationUpdates will fail
while (!getmGoogleApiClient().isConnected()) {
try {
Thread.sleep(300);
} catch (Exception ex) {
}
}
Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.post(new Runnable() {
public void run() {
//don't be too aggressive for location updates in the background
LocationRequest req = LocationRequest.create();
setupBackgroundLocationRequest(req);
Context context = AndroidNativeUtil.getContext().getApplicationContext();
Intent intent = new Intent(context, BackgroundLocationHandler.class);
//there is an bug that causes this to not to workhttps://code.google.com/p/android/issues/detail?id=81812
//intent.putExtra("backgroundClass", getBackgroundLocationListener().getName());
//an ugly workaround to the putExtra bug
intent.setData(Uri.parse("http://codenameone.com/a?" + bgListenerClass.getName()));
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), req, pendingIntent);
}
});
}
});
t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler);
t.start();
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:46,
代码来源:AndroidLocationPlayServiceManager.java
示例21: addGeoFencing
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
public void addGeoFencing(final Class GeofenceListenerClass, final com.codename1.location.Geofence gf) {
//Display.getInstance().scheduleBackgroundTask(new Runnable() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//wait until the client is connected, otherwise the call to
//requestLocationUpdates will fail
//com.codename1.io.Log.p("PLACES add "+gf.getId()+" 1");
while (!getmGoogleApiClient().isConnected()) {
try {
Thread.sleep(300);
} catch (Exception ex) {
}
}
//com.codename1.io.Log.p("PLACES add "+gf.getId()+" 2");
Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.post(new Runnable() {
public void run() {
Context context = AndroidNativeUtil.getContext();
Intent intent = new Intent(context, GeofenceHandler.class);
intent.putExtra("geofenceClass", GeofenceListenerClass.getName());
intent.putExtra("geofenceID", gf.getId());
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
ArrayList<Geofence> geofences = new ArrayList<Geofence>();
geofences.add(new Geofence.Builder()
.setRequestId(gf.getId())
.setCircularRegion(gf.getLoc().getLatitude(), gf.getLoc().getLongitude(), gf.getRadius())
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER
| Geofence.GEOFENCE_TRANSITION_EXIT)
.setExpirationDuration(gf.getExpiration() > 0 ? gf.getExpiration() : Geofence.NEVER_EXPIRE)
.build());
LocationServices.GeofencingApi.addGeofences(getmGoogleApiClient(), geofences, pendingIntent);
}
});
}
});
t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler);
t.start();
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:47,
代码来源:AndroidLocationPlayServiceManager.java
示例22: isGPSEnabled
点赞 2
import com.codename1.impl.android.AndroidNativeUtil; //导入依赖的package包/类
@Override
public boolean isGPSEnabled() {
Context context = AndroidNativeUtil.getContext();
android.location.LocationManager locationManager = (android.location.LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
return locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER);
}
开发者ID:codenameone,
项目名称:CodenameOne,
代码行数:7,
代码来源:AndroidLocationPlayServiceManager.java