LocationService.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:AstronomyTourPadova 作者:
@Override
public void onCreate() {
    Log.d(TAG, "onCreate");
    googleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(LocationServices.API)
        .build();
    googleApiClient.connect();

    createLocationRequest("highest");

    LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
    builder.addLocationRequest(locationRequest);
    builder.setAlwaysShow(true); // "This app wants to change your device settings for GPS location"
    locationSettingsRequest = builder.build();

    HandlerThread handlerThread = new HandlerThread(TAG);
    handlerThread.start();
    handler = new Handler(handlerThread.getLooper());
    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    currentNotificationTitle = getResources().getString(R.string.app_name);
    currentNotificationText = getResources().getString(R.string.notification_desc);

    // Handling interaction with WiFi
    wifiConnected = Utils.isWifiConnected(getApplicationContext());

    // Listening to Network changes (WiFi mostly)
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("android.net.wifi.WIFI_STATUS_CHANGED");
    intentFilter.addAction("android.net.wifi.STATUS_CHANGE");

    registerReceiver(AtNetworkReceiver, intentFilter);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号