UWP - how can I test a closing of app when trial are expired with CurrentAppSimulator? - win-universal-app

I have a problem with trial period in my app and I tried to reproduce it in the test mode.
I want to test the following behaviour:
App has trial period of 1 day.
The user opens the app a day later, when trial is expired.
According to this documentation the message dialog will be shown.
When I tried testing this scenario, I found the file called %userprofile%\AppData\local\packages\<package name>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml.
This file contains:
<LicenseInformation>
<App>
<IsActive>false</IsActive>
<IsTrial>false</IsTrial>
</App>
........
</LicenseInformation>
In this case my app is open. But look at the behaviour when I check a license using this code:
LicenseInformation^ licenseInfo = CurrentAppSimulator::LicenseInformation;
if( !licenseInfo->IsActive )
{
//I get into the code section
}
But my app still opens successfully.
Will my app be closed by the OS in this case, when I publish it in Store and load with Store (with Windows::ApplicationModel::Store::CurrentApp and according to the documentation)?
How can I simulate this closing (by the OS)?

Related

Intermittent behavior in xpages application: by pressing the button to save, the document is not redirected and is displayed again

I'm having a problem with a new xpages application that was deployed in production for a few months, but has now only been expanded to the entire enterprise now. The problem that did not happen while the application was in production pilot is intermittent and happens when an action executes a current notesxsppdocument save (currentdocument). The symptom is that by pressing the button you save, the document is not redirected and is displayed again. What can be this problem. session timeout, a bug from xpages? The application basically uses the components of the extension library, there is no external component to the xpages. When the problem occurs, if the user closes the document's xpages opens again and then clicks the button again the code runs successfully.
I have a function that stores a file attached to the doc in a repository. I suspect she's the problem. The function uses the file upload component and a button to execute a java agent that stores the file in a repository. The button code below follows. Its function is basically to create the rich text if it does not exist and call the agent that consumes a web service to transfer the file to a repository and erase it from the document.
I asked the user not to use the function for a few days at the time of the service to verify that the problem will persist.
if(validaArquivo())
{
var url=#ReplaceSubstring(context.getUrl(),"openDocument","editDocument")
url += '&tab=dossie' ;
var fieldItem:NotesItem =
currentDocument.getDocument().getFirstItem("arquivos");
if (fieldItem==null){
// create the field as an RTF
//writeToLog("Creating xxxxx field");
var rtItem:NotesRichTextItem =
currentDocument.getDocument().createRichTextItem("arquivos");
currentDocument.save();
}else if (fieldItem.getType()==1280){
//writeToLog("--> Converting xxxxx to RTF");
currentDocument.replaceItemValue("arquivosTEXT",
fieldItem.getText());
fieldItem.remove();
var rtItem:NotesRichTextItem =
currentDocument.getDocument().createRichTextItem("arquivos");
currentDocument.save();
}
var agente:NotesAgent=database.getAgent("(SalvaAnexos)");
agente.runWithDocumentContext(currentDocument.getDocument(true));
context.redirectToPage(url)
}
else
{
document1.removeAllAttachments("arquivos");
}
When users are using the application, rebuild or to change some code on prod environment can cause this.

Google analytics stores username and password as a part of url

Issue Context:
I am using meteor js for a mobile app.
I have hooked it up with google analytics calls and basically I am using two type of calls:
Screen views
Events
Screen views are just fine, but I'm facing an issue with the events.
When I go to Behavior -> Events -> Screens, in the google analytics dashboard, I can see the URL of every page that has triggered an event under the Screen Name column. My problem is that the page URLs for my login page look something like this:
meteor.local/login?username=*******&password=+++++++&rememberMe=on
Where ******* is an actual username and +++++++ is the corresponding password!
Reason:
Since I have to share this analytics account with multiple people, I do not want this information to be available over here.
Clues:
CLUE 1:
I used to do GET http calls, but I have changed them all to POST and it still has not fixed the issue as I expected it not to pass plain parameters through URL anymore.
CLUE 2:
I've noticed that the default google analytics js framework is working with http and not https. I was wondering if it is calling the analytics server with a GET as well. If so, is there anyway to change that?
CLUE 3:
Here is how I am initiating the GA instance:
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', googleKey, 'auto');
CLUE 4:
I have also noticed that these URLs are getting captured very occasionally. E.g. in the pas 12,500 unique events (about 30,000 total events) it has captured just 9 URLs with the username and password. The remaining 12,491 events have
meteor.local/login
OR
meteor.local/--
OR
localhost/--
as the Screen Name.
CLUE 5:
I have also put 4 "search and replace" global filters on the analytics account to search for this string
meteor.local/.*
and replace it with this one
meteor.local/concealedURI
This does not seem to be working either.
I have added this filter on 4 different fields (Since I still really don't know where the URLs are coming from):
Host Name
Page Title
Referral
Request URI
CLUE 6:
This is how I am calling the GA instance to send the event:
ga('send', 'event', 'button', 'click', eventName);
Okay. So, I had to run a lot of experiments and try out different things to solve this issue.
After trying all the things that I have described in the question, I finally found a way to address this problem.
The main cause of this problem was that I was using a google analytics account set to track an App, to capture the data from an app that was built with meteor js (which basically utilizes cordova).
Using meteor means that my app's screens are actually web pages rendered as a mobile app. It seems like meteor uses URLs to navigate through these screens.
On the other hand, google analytics looks at (and captures) the screen name of an app's page, when an event is triggered from that page. In native apps this screen name will be something similar to "About us", "Contact Us", "Home", etc.
Now since a meteor app is not the same, the screen name returned by meteor is actually the URL of the page that has triggered the event.
This does not have anything to do with the http calls (Whether or not they are GET or POST), because it is the local URL used by meteor for navigating that is being passed down to google analytics and not any http calls.
Solutions
1.
If I had the google analytics account set as a web page tracker, I could have access to "Exclude URL Query Parameters" field and I could potentially exclude username and password as was suggested by #Mike and #PhilipPryde in the comments.
However, I needed to use google analytics set as an app tracker. So, this did not work for me.
Failed
2.
I did put a filter on the whole view in the google analytics and searched for meteor.local/.* and replaced that with hiddenURL. The filters on
Host Name
Page Title
Referral
Request URI
did not work.
But when I put the same filter on
Screen Label
field, it worked.
However, this only looked at the screen names returned by screen view hits and not the event. Thus, this did not actually solve my issue either.
Failed
Finally, I had to do this:
There is a method call on GA instance that lets you set different options up. I ended up using this:
ga('set', 'screenName', 'hiddenURL');
This changed the screen name to "hiddenURL". So, I used this before every event and it worked for me.
My code for sending events to google analytics looked like this:
ga('set', 'screenName', 'hiddenURL');
ga('send', 'event', 'button', 'click', eventName);
PS:
This changes the screen name that was showing up in real-time reports of google analytics to "hiddenURL", whenever someone triggered an event. But, it changes back to a screen name as soon as they go to another page. So, it would not also mess with any of your screen view data either, since it is not being captured as a screen view.
Of course that is because, I pass the screen name to my GA instance every time I send a screen view. So it looks like this:
sendScreenViewToGA = function (screenName) {
ga('send', 'screenview', {
'appName': 'Something',
'screenName': screenName,
'appVersion': x.x
});
}
If I had used the screen name, that is being set on the environment tight now, I would have ended up with all my screen names in analytics set to "hiddenURL".
I really hope this post will help others with same issues and save them some time.

display sharepoint app in outlook 2013 and owa

I have created an SharePoint- hosted app and using office API’s within the start page. The app is added in exchange and enter image description hereapp web links are referred in appmanifest.xml.
1) On click of link, page renders as expected in OWA every time except for 1st time, following error occurs .
"App Error Something went wrong and we couldn't start this app. Please
try again later or contact your system administrator." console log
shows:“Uncaught Sys.ArgumentNullException: Sys.ArgumentNullException:
Value cannot be null.Parameter name: conversationId “ in
outlook-web-16.00.js:
It works as expected in subsequent calls.
2) The app doesn’t load in outlook client. Following error occurs in Microsoft Office Alerts :
App Error This app could not be started. Close this dialog to ignore
the problem or click "Restart" to try again. P1: Apps for Office P2:
15.0.4719.1001 P3: 0x80010105 P4: following is displayed in fiddler: X-MSDAVEXT_Error: 917656; HTTP/1.1 401 Unauthorized ........ ..
Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically.
.....
All suggestions are highly appreciated.
This issue appears when we debug outlook apps in debug mode and the app exceeded the allotted time to load required office 365 js files into your app.
One thing i am doing to avoid this issue, in the browser you are using to authenticate using o365 account, check the box to login automatically to save time and load client js files faster post authentication step.

forge.facebook.authorize returning incorrect Facebook token expiry time

I've been using forge.facebook.authorize() successfully for several months in my app to get FB auth tokens.
However since a certain point last week I've been unable to validate any of the tokens it's been returning, due to an incorrect expiry time, and thus unable to sign-up or log-in any Facebook users since.
I must make clear that none of my code changed - this FB login was working fine previously and then suddenly stopped and hasn't since. A deployed live app suddenly stopped letting users log in with Facebook.
reponse from forge.facebook.authorize:
[FORGE] '"successfully authorized with FB",
{"access_token":"....","access_expires":1367922592459}'
I then turn the expiry seconds into a JS date object with this function:
function toDateTime(secs) {
var t = new Date();
t.setSeconds(secs * -1);
return t;
}
toDateTime(1367922592459);
> Sun Jun 11 -41335 12:22:41 GMT+0100 (BST)
See here the year is showing something crazy, definitely before Facebook was invented.
So anyway, then my code passes the FB auth data to Parse.com to log in a user, and Parse.com obviously throws it back for having an invalid expiry time.
The problem is occurring on iOS and Android apps built with trigger.io v1.4.29 and v1.4.33
Note: I have a working FB javascript login on my webpage (http://wewana.com/) which is connecting to the same Facebook app and the same Parse.com application. This page is not exhibiting any problems, so it seems the FB app is fine.
t.setSeconds(secs * -1);
Are you intentionally multiplying by -1? I'm not seeing why this could be expected to work.
var d = new Date(1367922592459);
There you go, simple and easy.
(Since JavaScript handles Date in milliseconds, there’s no need to do /1000 or something.)
tldr;
I was incorrectly processing the expiry timestamps as seconds. Processing them as milliseconds fixes the issue. Clearly there was an issue with toDateTime()
Full version:
For some time parse.com has been accepting invalid FB expiry dates. As users were getting logged in fine we did not know there was a problem.
Recently parse changed something so they error on invalid dates, causing our login to break.
Our function that translated seconds into a JS date object needed to be changed to convert based on milliseconds.
New working function:
function toDateTime(secs) {
var t = new Date(0);
t.setUTCSeconds(secs / 1000);
return t;
}

Show alert about internet connectivity before launching the application (Monotouch)

I am developing an app that requires an internet connection, so I want to check the availability before launch.
If internet connection it is not available, show an alert to the user and go back to Home instead of trying to launch the app.
So I used the Reachability class, that was recommended here (http://stackoverflow.com/questions/1961341/check-for-internet-access-with-monotouch) to check the internet connection.
So far so good. But if I place this check in my Main.cs, it performs the check, but will not display the alert.
if(!Reachability.IsHostReachable("http://google.com")) {
Debug.WriteLine("OFFLINE");
UIAlertView alert = new UIAlertView("Offline","Voor deze app is een internetverbinding vereist.",null,"OK",null);
alert.Show();
}
else{
MPFramework.Application app = new MPFramework.Application();
UIApplication.Main (args, null, "AppDelegate");
}
If I place this check in AppDelegate.cs it performs the check, displays the alert, but keeps a black screen instead of returning to Home.
So where do I place my code in order to check before launching the app, and displaying an alert?
You're looking at this a bit wrong:
Apple doesn't approve of apps that kill/close themselves (see this: https://stackoverflow.com/a/356342/183422). If the user wants to close your app, he should do it himself.
You need the main loop running to show any UI - and that main loop is started when you call UIApplication.Main (which is why you have to do the check in AppDelegate.cs and show the corresponding alert there instead of in your Main method).
So, putting these things together, I think you should show a blank/splash screen, check for reachability and if there is none then show the alert (and if the user dismisses the alert, maybe check again).

Resources