void Network::Run(const String& command) { if (!command.IsEmpty()) { String args; String delim(L"/"); command.SubString(String(L"gap://").GetLength(), args); StringTokenizer strTok(args, delim); if(strTok.GetTokenCount() < 3) { AppLogDebug("Not enough params"); return; } String method; String hostAddr; strTok.GetNextToken(method); strTok.GetNextToken(callbackId); strTok.GetNextToken(hostAddr); // URL decoding Uri uri; uri.SetUri(hostAddr); AppLogDebug("Method %S, callbackId %S, hostAddr %S URI %S", method.GetPointer(), callbackId.GetPointer(), hostAddr.GetPointer(), uri.ToString().GetPointer()); if(method == L"org.apache.cordova.Network.isReachable") { IsReachable(uri.ToString()); } AppLogDebug("Network command %S completed", command.GetPointer()); } else { AppLogDebug("Can't run empty command"); } }
void Accelerometer::Run(const String& command) { if (!command.IsEmpty()) { Uri commandUri; commandUri.SetUri(command); String method = commandUri.GetHost(); StringTokenizer strTok(commandUri.GetPath(), L"/"); if(strTok.GetTokenCount() == 1) { strTok.GetNextToken(callbackId); AppLogDebug("Method %S, CallbackId: %S", method.GetPointer(), callbackId.GetPointer()); } if(method == L"com.cordova.Accelerometer.watchAcceleration" && !callbackId.IsEmpty() && !IsStarted()) { StartSensor(); } if(method == L"com.cordova.Accelerometer.clearWatch" && IsStarted()) { StopSensor(); } if(method == L"com.cordova.Accelerometer.getCurrentAcceleration" && !callbackId.IsEmpty() && !IsStarted()) { GetLastAcceleration(); } AppLogDebug("Acceleration command %S completed", command.GetPointer()); } else { AppLogDebug("Can't run empty command"); } }
void GeoLocation::GetLastKnownLocation() { Location *location = locProvider->GetLastKnownLocationN(); if(location->GetQualifiedCoordinates() != null) { const QualifiedCoordinates *q = location->GetQualifiedCoordinates(); double latitude = q->GetLatitude(); double longitude = q->GetLongitude(); float altitude = q->GetAltitude(); float accuracy = q->GetHorizontalAccuracy(); float heading = q->GetVerticalAccuracy(); float speed = location->GetSpeed(); long long timestamp = location->GetTimestamp(); AppLogDebug("new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading); String coordinates; coordinates.Format(256, L"new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading); String res; res.Format(512, L"PhoneGap.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(), coordinates.GetPointer(), timestamp); pWeb->EvaluateJavascriptN(res); } else { AppLogDebug("PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer()); String res; res.Format(256, L"PhoneGap.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(res); } }
void Network::OnTransactionAborted (HttpSession &httpSession, HttpTransaction &httpTransaction, result r) { AppLogDebug("Transaction Aborted"); String res; res.Format(128, L"Cordova.callbacks['%S'].fail({code:%d,message:'%s'});", callbackId.GetPointer(), r, GetErrorMessage(r)); AppLogDebug("%S", res.GetPointer()); pWeb->EvaluateJavascriptN(res); }
void Kamera::OnAppControlCompleted (const String &appControlId, const String &operationId, const IList *pResultList) { //This method is invoked when an application control callback event occurs. String* pCaptureResult = null; if (appControlId.Equals(APPCONTROL_CAMERA) && operationId.Equals(OPERATION_CAPTURE)) { pCaptureResult = (Osp::Base::String*)pResultList->GetAt(0); if (pCaptureResult->Equals(String(APPCONTROL_RESULT_SUCCEEDED))) { String eval; AppLog("Camera capture success."); String* pCapturePath = (String*)pResultList->GetAt(1); // copying to app Home Folder String homeFilename; homeFilename.Format(128, L"/Home/%S", File::GetFileName(*pCapturePath).GetPointer()); result r = File::Copy(*pCapturePath, homeFilename, true); if(IsFailed(r)) { AppLogException("Could not copy picture"); eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer()); AppLogDebug("%S", eval.GetPointer()); pWeb->EvaluateJavascriptN(eval); } // Uri imageUri; // imageUri.setUri(homeFilename); eval.Clear(); eval.Format(512, L"PhoneGap.callbacks['%S'].success('file://%S')", callbackId.GetPointer(), homeFilename.GetPointer()); AppLogDebug("%S", eval.GetPointer()); pWeb->EvaluateJavascriptN(eval); } else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_CANCELED))) { AppLog("Camera capture canceled."); String eval; eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); } else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_FAILED))) { AppLog("Camera capture failed."); String eval; eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); } } }
void Notification::Vibrate(const long milliseconds) { AppLogDebug("Trying to vibrate the device for %d", milliseconds); Vibrator vibrator; vibrator.Construct(); vibrator.Start(milliseconds, 99); Osp::Base::Runtime::Thread::Sleep(milliseconds + 1000); }
void Notification::Run(const String& command) { if(!command.IsEmpty()) { Uri commandUri; commandUri.SetUri(command); String method = commandUri.GetHost(); StringTokenizer strTok(commandUri.GetPath(), L"/"); if(strTok.GetTokenCount() < 1) { AppLogException("Not enough params"); return; } if((method == L"com.phonegap.Notification.alert" || method == L"com.phonegap.Notification.confirm")) { strTok.GetNextToken(callbackId); AppLogDebug("%S %S", method.GetPointer(), callbackId.GetPointer()); if(!callbackId.IsEmpty()) { Dialog(); } } else if(method == L"com.phonegap.Notification.vibrate") { long duration; String durationStr; strTok.GetNextToken(durationStr); AppLogDebug("%S %S", method.GetPointer(), durationStr.GetPointer()); // Parsing duration result r = Long::Parse(durationStr, duration); if(IsFailed(r)) { AppLogException("Could not parse duration"); return; } Vibrate(duration); } else if(method == L"com.phonegap.Notification.beep") { int count; String countStr; strTok.GetNextToken(countStr); AppLogDebug("%S %S", method.GetPointer(), countStr.GetPointer()); // Parsing count result r = Integer::Parse(countStr, count); if(IsFailed(r)) { AppLogException("Could not parse count"); return; } Beep(count); } } }
bool BaseWordForm::SetSpeechToTextListener(ISpeechToTextEventListener *isttl) { // when is isttl null not create new helper if (!__pSTTH && isttl != null) { AppLogDebug("__pSTTH = new SpeechToTextHelper()"); __pSTTH = new SpeechToTextHelper(); } // must set isttl before init because // after init success will call __pSTTH->OnSpeechToTextInitialized // and __pSTTH->OnSpeechToTextInitialized call isttl->OnSpeechToTextInitialized if (__pSTTH) { __pSTTH->SetListener(isttl); // when was initialized before // call OnSpeechToTextInitialized manualy // if (isttl && __pSTTH->IsInitialized()) // { // AppLogDebug("__pSTTH->SetListener and __pSTTH->OnSpeechToTextInitialized()"); // __pSTTH->OnSpeechToTextInitialized(); // } // else // if (__pSTTH->IsNotWorks()) // { // AppLogDebug("__pSTTH->SetListener and __pSTTH->OnSpeechToTextErrorOccurred(STT_ERROR_INITIALIZATION_FAILED)"); // __pSTTH->OnSpeechToTextErrorOccurred(STT_ERROR_INITIALIZATION_FAILED); // delete __pSTTH; // __pSTTH = null; // } } // wasn't initialized -> init if (__pSTTH && !__pSTTH->IsInitialized()) { AppLogDebug("call __pSTTH->Init()"); if (!__pSTTH->Init()) { delete __pSTTH; __pSTTH = null; return false; } } return true; }
void Compass::Run(const String& command) { if (!command.IsEmpty()) { String args; String delim(L"/"); command.SubString(String(L"gap://").GetLength(), args); StringTokenizer strTok(args, delim); if(strTok.GetTokenCount() < 2) { AppLogDebug("Not Enough Params"); return; } String method; strTok.GetNextToken(method); // Getting callbackId strTok.GetNextToken(callbackId); AppLogDebug("Method %S, callbackId: %S", method.GetPointer(), callbackId.GetPointer()); // used to determine callback ID if(method == L"com.phonegap.Compass.watchHeading" && !callbackId.IsEmpty() && !IsStarted()) { AppLogDebug("watching compass..."); StartSensor(); } if(method == L"com.phonegap.Compass.clearWatch" && !callbackId.IsEmpty() && IsStarted()) { AppLogDebug("stop watching compass..."); StopSensor(); } if(method == L"com.phonegap.Compass.getCurrentHeading" && !callbackId.IsEmpty() && !IsStarted()) { AppLogDebug("getting current compass..."); GetLastHeading(); } AppLogDebug("Compass command %S completed", command.GetPointer()); } else { AppLogDebug("Can't run empty command"); } }
void BaseWordForm::OnFormBackRequested(Osp::Ui::Controls::Form &source) { if (__pBackForm) { Utils::ShowFront(__pBackForm, &source); } else { AppLogDebug("call OnFormBackRequested, but the __pBackForm isn\'t set!"); } }
bool Compass::StopSensor(void) { result r = E_SUCCESS; r = __sensorMgr.RemoveSensorListener(*this, SENSOR_TYPE_MAGNETIC); if(IsFailed(r)) { return false; } started = false; AppLogDebug("Stopped Watching Sensor"); return true; }
bool Accelerometer::StopSensor(void) { result r = E_SUCCESS; r = __sensorMgr.RemoveSensorListener(*this, SENSOR_TYPE_ACCELERATION); if(IsFailed(r)) { return false; } started = false; AppLogDebug("Stopped Watching Sensor"); return true; }
void GeoLocation::Run(const String& command) { if(!command.IsEmpty()) { Uri commandUri; commandUri.SetUri(command); String method = commandUri.GetHost(); StringTokenizer strTok(commandUri.GetPath(), L"/"); if(strTok.GetTokenCount() > 1) { strTok.GetNextToken(callbackId); AppLogDebug("Method %S, CallbackId: %S", method.GetPointer(), callbackId.GetPointer()); } AppLogDebug("Method %S, Callback: %S", method.GetPointer(), callbackId.GetPointer()); // used to determine callback ID if(method == L"com.phonegap.Geolocation.watchPosition" && !callbackId.IsEmpty() && !IsWatching()) { AppLogDebug("watching position..."); StartWatching(); } if(method == L"com.phonegap.Geolocation.stop" && IsWatching()) { AppLogDebug("stop watching position..."); StopWatching(); } if(method == L"com.phonegap.Geolocation.getCurrentPosition" && !callbackId.IsEmpty() && !IsWatching()) { AppLogDebug("getting current position..."); GetLastKnownLocation(); } AppLogDebug("GeoLocation command %S completed", command.GetPointer()); } }
void DebugConsole::Log(String& statement, String& logLevel) { if(!statement.IsEmpty()) { if(logLevel == L"INFO" || logLevel == L"WARN") { AppLog("[%S] %S", logLevel.GetPointer(), statement.GetPointer()); } else if(logLevel == "DEBUG") { AppLogDebug("[%S] %S", logLevel.GetPointer(), statement.GetPointer()); } else if(logLevel == L"ERROR") { AppLogException("[%S] %S", logLevel.GetPointer(), statement.GetPointer()); } } }
bool WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType type) { AppLogDebug("URL REQUESTED %S", url.GetPointer()); if(url.StartsWith("gap://", 0)) { // __cordovaCommand = null; __cordovaCommand = new String(url); // FIXME: for some reason this does not work if we return true. Web freezes. // __pWeb->StopLoading(); // String* test; // test = __pWeb->EvaluateJavascriptN(L"'test'"); // AppLogDebug("String is %S", test->GetPointer()); // delete test; // return true; return false; } else if(url.StartsWith("http://", 0) || url.StartsWith("https://", 0)) { AppLogDebug("Non Cordova command. External URL. Launching WebBrowser"); LaunchBrowser(url); return false; } return false; }
void Network::IsReachable(const String& hostAddr) { String* pProxyAddr = null; //String hostAddr = L"http://localhost:port"; AppLogDebug("Trying to reach...%S", hostAddr.GetPointer()); __pHttpSession = new HttpSession(); __pHttpSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, pProxyAddr, hostAddr, null); HttpTransaction* pHttpTransaction = __pHttpSession->OpenTransactionN(); pHttpTransaction->AddHttpTransactionListener(*this); HttpRequest* pHttpRequest = pHttpTransaction->GetRequest(); pHttpRequest->SetMethod(NET_HTTP_METHOD_GET); pHttpRequest->SetUri(hostAddr); pHttpTransaction->Submit(); }
void Compass::OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) { sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_TIMESTAMP, timestamp); sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_X, x); sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_Y, y); sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_Z, z); AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp); String res; res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp); pWeb->EvaluateJavascriptN(res); }
void Network::OnTransactionCompleted (HttpSession &httpSession, HttpTransaction &httpTransaction) { HttpResponse* pHttpResponse = httpTransaction.GetResponse(); NetHttpStatusCode statusCode = pHttpResponse->GetStatusCode(); int status = 1; // Default is DATA NETWORK // FIXME: Bada has no standard/apparent way of knowing the current network type // We have to get the network type from the system info // ...and if Wifi is enabled we override the setting to Wifi String key(L"NetworkType"); String networkType; result r = SystemInfo::GetValue(key, networkType); if(r == E_SUCCESS && networkType != L"NoService" && networkType != L"Emergency") { AppLogDebug("Data Enabled, Network Type %S, Status Code: %d", networkType.GetPointer(), statusCode); status = 1; } Wifi::WifiManager manager; if(manager.IsActivated() && manager.IsConnected()) { AppLogDebug("Wifi Enabled"); status = 2; } String res; res.Format(256, L"navigator.network.updateReachability({code:%d,http_code:%d});", status, statusCode); AppLogDebug("%S", res.GetPointer()); pWeb->EvaluateJavascriptN(res); res.Format(128, L"Cordova.callbacks['%S'].success({code:%d,http_code:%d});", callbackId.GetPointer(), status, statusCode); AppLogDebug("%S", res.GetPointer()); pWeb->EvaluateJavascriptN(res); }
void WebForm::OnLoadingCompleted() { // Setting DeviceInfo to initialize Cordova (should be done only once) and firing onNativeReady event String* deviceInfo; deviceInfo = __pWeb->EvaluateJavascriptN(L"window.device.uuid"); if(deviceInfo->IsEmpty()) { device->SetDeviceInfo(); __pWeb->EvaluateJavascriptN("Cordova.onNativeReady.fire();"); } else { //AppLogDebug("DeviceInfo = %S;", deviceInfo->GetPointer()); } delete deviceInfo; // Analyzing Cordova command if(__cordovaCommand) { if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Geolocation", 0)) { geolocation->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Accelerometer", 0)) { accel->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Network", 0)) { network->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.DebugConsole", 0)) { console->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Compass", 0)) { compass->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Contacts", 0)) { contacts->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Notification", 0)) { notification->Run(*__cordovaCommand); } else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Camera", 0)) { camera->Run(*__cordovaCommand); } // Tell the JS code that we got this command, and we're ready for another __pWeb->EvaluateJavascriptN(L"Cordova.queue.ready = true;"); delete __cordovaCommand; __cordovaCommand = null; } else { AppLogDebug("Non Cordova command completed"); } }
void Notification::Beep(const int count) { AppLogDebug("Trying to beep the device"); result r = E_SUCCESS; TouchEffect *pTouchEffect = null; pTouchEffect = new Osp::Uix::TouchEffect(); r = pTouchEffect->Construct(); if(r == E_SUCCESS) { for(int i = 0 ; i < count && r == E_SUCCESS ; i++) { r = pTouchEffect->Play(TOUCH_EFFECT_SOUND); Osp::Base::Runtime::Thread::Sleep(1000); } } }
void Accelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) { sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_TIMESTAMP, timestamp); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_X, x); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Y, y); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Z, z); AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp); String res; res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp); pWeb->EvaluateJavascriptN(res); res.Clear(); res.Format(256, L"navigator.accelerometer.lastAcceleration = new Acceleration(%f,%f,%f,%d});", x, y, z, timestamp); pWeb->EvaluateJavascriptN(res); }
bool Accelerometer::StartSensor(void) { result r = E_SUCCESS; if(__sensorMgr.IsAvailable(SENSOR_TYPE_ACCELERATION)) { r = __sensorMgr.AddSensorListener(*this, SENSOR_TYPE_ACCELERATION, 50, true); if(IsFailed(r)) { return false; } } else { AppLogException("Acceleration sensor is not available"); String res; res.Format(256, L"PhoneGap.callbacks['%S'].fail({message:'Acceleration sensor is not available',code:'001'});"); pWeb->EvaluateJavascriptN(res); return false; } started = true; AppLogDebug("Start Watching Sensor"); return true; }
void WebForm::LaunchBrowser(const String& url) { ArrayList* pDataList = null; pDataList = new ArrayList(); pDataList->Construct(); String* pData = null; pData = new String(L"url:"); pData->Append(url); AppLogDebug("Launching Stock Browser with %S", pData->GetPointer()); pDataList->Add(*pData); AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_BROWSER, ""); if(pAc) { pAc->Start(pDataList, null); delete pAc; } pDataList->RemoveAll(true); delete pDataList; }
bool Compass::StartSensor(void) { result r = E_SUCCESS; if(__sensorMgr.IsAvailable(SENSOR_TYPE_MAGNETIC)) { r = __sensorMgr.AddSensorListener(*this, SENSOR_TYPE_MAGNETIC, 50, true); if(IsFailed(r)) { return false; } } else { AppLogException("Compass sensor is not available"); String res; res.Format(256, L"PhoneGap.callbacks['%S'].fail({message:'Magnetic sensor is not available',code:'001'});", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(res); return false; } started = true; AppLogDebug("Start Watching Sensor"); return true; }
void Kamera::GetPicture() { AppLogDebug("Taking picture"); ArrayList* pDataList = null; pDataList = new ArrayList(); pDataList->Construct(); String* pData = null; pData = new String(L"type:camera"); pDataList->Add(*pData); AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_CAMERA, OPERATION_CAPTURE); if(pAc) { pAc->Start(pDataList, this); delete pAc; } pDataList->RemoveAll(true); delete pDataList; }
void DebugConsole::Run(const String& command) { if(!command.IsEmpty()) { String args; String delim(L"/"); command.SubString(String(L"gap://").GetLength(), args); StringTokenizer strTok(args, delim); if(strTok.GetTokenCount() < 3) { AppLogDebug("Not enough params"); return; } String method; String statement(64); String logLevel; strTok.GetNextToken(method); strTok.GetNextToken(statement); CleanUp(statement); strTok.GetNextToken(logLevel); //AppLogDebug("method %S statement %S loglevel %S", method.GetPointer(), statement.GetPointer(), logLevel.GetPointer()); if(method == L"com.phonegap.DebugConsole.log") { Log(statement, logLevel); } } }
void Notification::Dialog() { MessageBox messageBox; String* title; String* message; String* styleStr; String eval; title = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.title"); message = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.message"); styleStr = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.messageBoxStyle"); AppLogDebug("title %S message %S styleStr %S", title->GetPointer(), message->GetPointer(), styleStr->GetPointer()); if(!title->IsEmpty() && !message->IsEmpty() && !styleStr->IsEmpty()) { int style; int modalResult = 0; if(Integer::Parse(*styleStr, style) != E_SUCCESS) { AppLogException("Could not get dialog style"); return; } messageBox.Construct(*title, *message, (MessageBoxStyle)style, 0); messageBox.ShowAndWait(modalResult); switch(modalResult) { case MSGBOX_RESULT_CLOSE: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Close')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_OK: eval.Format(128, L"PhoneGap.callbacks['%S'].success('OK')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_CANCEL: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Cancel')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_YES: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Yes')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_NO: eval.Format(128, L"PhoneGap.callbacks['%S'].success('No')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_ABORT: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Abort')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_TRY: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Try')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_RETRY: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Retry')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_IGNORE: eval.Format(128, L"PhoneGap.callbacks['%S'].success('Ignore')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; case MSGBOX_RESULT_CONTINUE: eval.Format(64, L"PhoneGap.callbacks['%S'].success('Continue')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); break; } } else { AppLogException("Could not construct MessageBox"); } delete title; delete message; delete styleStr; }
void GeoLocation::StopWatching() { locProvider->CancelLocationUpdates(); watching = false; AppLogDebug("Stop Watching Location"); }
void GeoLocation::StartWatching() { locProvider->RequestLocationUpdates(*this, 5, false); watching = true; AppLogDebug("Start Watching Location"); }