I need to share a video link from the Youtube app to my Codename One app on iOS.
It seems possible, according to: https://stackoverflow.com/a/38036939/1277576
With Codename One, I tried to add these build hints:
ios.plistInject=<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLName</key><string>net.informaticalibera.myappname</string></dict><dict><key>CFBundleURLSchemes</key><array><string>https</string></array></dict></array>
ios.urlScheme=<string>https</string>
and I added this code to a bare bones project:
public void start() {
if (current != null) {
current.show();
return;
}
String url = Display.getInstance().getProperty("AppArg", null);
Form hi = new Form("Test case", BoxLayout.y());
if (url != null) {
hi.add(new SpanLabel("Intercepted URL:\n" + url));
} else {
hi.add(new Label("No URL was intercepted"));
}
hi.show();
}
but it doesn't work: when I share a video link, Youtube offers me several apps, but not mine.
You need to also implement it in native code and I think there are also changes required to the xcode project if I remember correctly from investigating this a while back. Currently we don't have official support for this use case but you can file an RFE for that.
My application can buy an in-app product which I have configured on the google developer account.
The product is a buy-once product. I would like to know how to check if this item has already been bought (in codenameone) and handle it based on result of query.
Here is a code extract:
if(p.isManagedPaymentSupported()) {
if(p.wasPurchased(id)){
boolUpdate = true;
Form f = (Form)createContainer(resPath,"Search");
beforeSearch(f);
f.show();
}else{
Display.getInstance().callSerially(new Runnable() {
public void run() {
Boolean confirmAction = Dialog.show("Buy Product?","","Yes","No");
if(confirmAction){
p.purchase(id);
}
}
});
}
}
According to the codenameone API doc, The "p.wasPurchased(id)" method is supposed to provide this functionality. But this is not the case after installing on my device and making a purchase. The payment process begins again even after the product has been bought. Meaning the "wasPurchased()" check is returning false.
I would like to check if the item is already purchased and based on that either go to the next screen, or begin the purchase process. Please how can I implement this on codenameone?
Thanks
Currently managed purchases aren't supported on Android which I'm assuming is the platform you are referring to?
There is an RFE and some code to resolve it but we didn't get around to do it as of this writing: http://code.google.com/p/codenameone/issues/detail?id=731
I have two requirements in my GWT 2.4.0 + GXT 2.2.4 + Amazon project,
We store the word documents in our app only (each login can access only his docs). Now i want that user can edit own word document online like ZOHO writer does. How can i achieve this functionality in my app?
We also stores the images, text files, word files, PDF files and others too. I want to show preview of those files when user clicks on the file. something like, docs.com. How to achieve this too?
I just need guidance that how can i achieve this two requirements. Any suggestion is appreciated.
Thanks.
GWT has come up with Wrapper class of Code mirror library for XML
Editor check this this is for client side
public XMLEditorPanel(int height, int width, final String xmlToDisplay) {
this.xmlToDisplay = xmlToDisplay;
setHeaderVisible(false);
setHeight(height);
setWidth(width);
config = new CodeMirrorConfiguration();
config.setLineNumbers(true);
config.setTextWrapping(false);
config.setAutoMatchParens(false);
editor = new CodeMirror(config);
editor.addInitializeHandler(new InitializeHandler() {
public void onInitialize(InitializeEvent event) {
editor.setParser(CodeMirror.PARSER_XML);
editor.setIndentUnit(2);
editor.setFocus();
if (xmlToDisplay != null && xmlToDisplay != "" && xmlToDisplay.length() > 0) {
editor.setValue(xmlToDisplay, false);
} else {
editor.setValue(" ", false);
}
editor.reindent();
}
});
editor.addValueChangeHandler(new ValueChangeHandler<String>() {
#Override
public void onValueChange(ValueChangeEvent<String> event) {
XMLEditorPanel.this.xmlToDisplay = editor.getValue();
}
});
add(editor);
}
We want to integrate Google maps into our C/C++ win32 application.
The whole idea is when user runs the application for the first time we request them to mark their location and then retrieve the coordinates of the user selected location and save into a database or file.
After it has been initialized we want to provide user with some pre tagged places and allow user to find direction from their place to that place. The coordinates of the pre tagged locations will be provided.
Is it possible to achieve what we want by using Google Api's, if yes then how??
And if there are legal issues regarding it??
Thanks.
For the answer to the legal question, the best place is to look at the Terms of Service, and then to consult a lawyer of course. Both terms of service for the Maps API as well as the Maps for Business Terms of Service explicitly prohibit the usage of geocoding data if it is not in conjunction with a Google Map:
Maps API TOS, relevant point is Section 10.1.1 (g):
https://developers.google.com/maps/terms#section_10_1
Business Maps Purchase Agreement, relevant point is 4.1 (l):
https://www.google.com/enterprise/earthmaps/legal/us/maps_purchase_agreement.html
If you need a more liberal alternative you might want to look at http://www.openstreetmap.org/ - the geocoding data offered there is covered under the Open Database License, which permits usage with attribution.
http://wiki.openstreetmap.org/wiki/Legal_FAQ
You can use Qt framework on Windows. You can integrate your win32 application with Qt. In Qt you may use QWebKit framework to communicate with your app and a webpage(which, in this scenario is a page containing a map from Google Maps) . Actually you can write hybrid applications with Qt. Take a look at Qt QWebKit documentation.
I needed the same and solved it by interfacing Google Maps via a Browser object.
*** Please read about WebBrowser control compatibility and follow the instructions.
Create an MFC dialog based project.
Add a CExplorer control. (See: https://msdn.microsoft.com/en-us/library/aa752046(v=vs.85).aspx).
When the main dialog of your program initializes, you need to initialize a global object
CExplorer1 m_Browser;
The first building block would be WriteHTML()
void WriteHTML(const wchar_t* html)
{
IDispatch* pHtmlDoc = m_Browser.get_Document();
if (!pHtmlDoc)
return;
CComPtr<IHTMLDocument2> doc1 = NULL;
doc1.Detach();
doc1.Attach((IHTMLDocument2*)pHtmlDoc);
if (!doc1)
return;
// Creates a new one-dimensional array
SAFEARRAY* psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1);
if (!psaStrings)
return;
BSTR bstr = SysAllocString(html);
if (bstr)
{
VARIANT* param;
HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m);
if (SUCCEEDED(hr))
{
param->vt = VT_BSTR;
param->bstrVal = bstr;
hr = SafeArrayUnaccessData(psaStrings);
if (SUCCEEDED(hr))
{
doc1->write(psaStrings);
doc1->close();
}
}
}
// SafeArrayDestroy calls SysFreeString for each BSTR!
if (psaStrings)
SafeArrayDestroy(psaStrings);
}
You should also add the browser control to your .rs file
CONTROL "",IDC_SGWEBBROWSER,"{8856F961-340A-11D0-A96B-
00C04FD705A2}",WS_TABSTOP,388,36,236,281
Among several ways to implement it, I found that creating a temporary HTML based on the coordinates and calling: m_Browser.Navigate(FileName, 0, 0, 0, 0);
is the best.
"FileName" is created based on the requested coordinates of the point on the map, along with other attributes as follow:
Assign a name and path to "FileName":
wchar_t FileName[2048];
GetCurrentDirectory(2048, FileName);
wcscat(FileName, L"\\test.html");
Filling the file with data and opening it with the browser control, whilst navigating Google Maps to the requested location:
Variables:
a. Latitude
b. Longitude
c. zoom (set to 10)
d. API key. (you need to obtain one)
Code (an alternative to the WriteHTML function)
CString HTML_TEXT;
CRect rect;
CWnd *pWnd = GetDlgItem(IDC_SGWEBBROWSER);
pWnd->GetWindowRect(&rect);
int w = rect.Width()-50, h = rect.Height()-50;
HTML_TEXT.Format(L"<!DOCTYPE html><html><meta http-equiv=\"X - UA - Compatible\" content=\"IE = edge\"><body><div id =\"googleMap\" style=\"width:%dpx;height:%dpx\"><script>function myMap(){var mapProp = {center:new google.maps.LatLng(%f, %f), zoom : 10};var map = new google.maps.Map(document.getElementById(\"googleMap\"), mapProp);marker = new google.maps.Marker({position: new google.maps.LatLng(%f, %f),map: map});}</script><script src = \"https://maps.googleapis.com/maps/api/js?key=%s&callback=myMap\"></script></div></body></html>", w, h, Latitude, Longitude, Latitude, Longitude, API_KEY);
FILE *fp = _wfopen(FileName, L"w");
fwprintf(fp, L"%s", HTML_TEXT.GetBuffer());
fclose(fp);
m_Browser.Navigate(FileName, 0, 0, 0, 0);
I use Entity Framework 4 and Self Tracking Entities. The schema is like:
Patient -> Examinations -> LeftPictures
-> RightPictures
So there is TrackableCollection of these two relationships Patient 1 - * ....Pictures.
Now when loading the customers Form and browsing the details I dont need to load these
data images, only when another form is loaded for Examination details!
I am using a class library as a Data Repository to get data from the database (SQL Server) and this code:
public List<Patient> GetAllPatients()
{
try
{
using (OptoEntities db = new OptoEntities())
{
List<Patient> list = db.Patients
.Include("Addresses")
.Include("PhoneNumbers")
.Include("Examinations").ToList();
list.ForEach(p =>
{
p.ChangeTracker.ChangeTrackingEnabled = true;
if (!p.Addresses.IsNull() &&
p.Addresses.Count > 0)
p.Addresses.ForEach(a => a.ChangeTracker.ChangeTrackingEnabled = true);
if (!p.PhoneNumbers.IsNull() &&
p.PhoneNumbers.Count > 0)
p.PhoneNumbers.ForEach(a => a.ChangeTracker.ChangeTrackingEnabled = true);
if (!p.Examinations.IsNull() &&
p.Examinations.Count > 0)
p.Examinations.ForEach(e =>
{
e.ChangeTracker.ChangeTrackingEnabled = true;
});
});
return list;
}
}
catch (Exception ex)
{
return new List<Patient>();
}
}
Now I need when calling the Examination details form to go and get all the Images for the Examination relationship (LeftEyePictures, RightEyePictures). I guess that is called Lazy Loading and I dont understood how to make it happen while I'm closing the Entities connection immidiately and I would like to stay like this.
I use BindingSource components through the application.
What is the best method to get the desired results?
Thank you.
Self tracking entities don't support lazy loading. Moreover lazy loading works only when entities are attached to live context. You don't need to close / dispose context immediately. In case of WinForms application context usually lives for longer time (you can follow one context per form or one context per presenter approach).
WinForms application is scenario for normal attached entities where all these features like lazy loading or change tracking work out of the box. STEs are supposed to be used in distributed systems where you need to serialize entity and pass it to another application (via web service call).