https network call ssl implementation using Javascript (Cordova) - javascript

In my cordova application, I am using https api calls using java script. In android platform it is working as expected. But the iOS api was not working with my iPad. When I investigated more, I found that it is related to ssl habndshake. I have added the following method to my app delegate
#implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{
return YES;
}
Now the api is working fine. But came to know that this is not recommended when application is uploaded to iTunes store. In native applications apple recommends to implement NSURLProtectionSpace api. I wish to know how this can be accomplished in cordova platform?

Related

How to simulate HTTPS on a native application?

I am using Instascan library which allows me to access camera on both desktop and mobile devices. However, when I convert the website to a native Android or Iphone app I cannot access the camera. The documentation of Instascan library says
Chrome requires HTTPS when using the WebRTC API. Any pages using this
library should be served over HTTPS
Is there a way to trick a native application to think that it is being served over HTTPS?

Azure Mobile App javascript Cordova client

I am developing App using Cordova and want to try using Azure App Service's Mobile App.
But from this official document
https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-backend-xamarin-ios-get-started-preview/
it contains iOS/Xamerin/WinApp/Android but javascript example.
My questions are:
Does the javascript version of Azure Mobile App client exist?
Is the client SDK the same with Mobile Service javascript client?
Is there tutorial of Mobile App javascript client?
thanks a lot.
Currently, the Mobile Apps service is in preview and not all features have been implemented yet.
Yes, the client SDK is the same as with Mobile Services. If you download the HTML quickstart client from your Mobile App, you'll see that the html page references the same library: MobileServices.Web-2.0.0-beta.min.js
You didn't asked for the backend but anyways...Note that a major drawback currently for JS developers is the fact the you can't create a Node backend for Mobile Apps yet.

Push Notifications/Messaging in HTML5 web App

I am looking to integrate Push Notification in my Jquery mobile web App using PhoneGap for Android. Is there any solution to put cloud messaging in web app like push notification.
My app is based on getting friends location and checked in new location so i was looking for messaging or push notification in web app.
i am also read about http://www.html5rocks.com/en/tutorials/eventsource/basics/
but this was not helpful for me.
If real time Push Notification not possible in HTML5 web app Please let me about asynchronous messaging like offline messaging in my app.
I recently implemented realtime messaging with the WebSocket protocol, it is easy to implement, very performant and it supports encryption.
Try Urban Airship. You get 1 million free push notifications every month.
It is also working with Phonegap.
Link: http://docs.urbanairship.com/build/phonegap.html
ScaleDrone allows pushing to (and from) PhoneGap and web. It will use Websockets if possible and other technologies when Websockets are unavailable.
There is an API for this: http://www.w3.org/TR/2014/WD-push-api-20141007/, but I wouldn't count on platform support here. However, since you are using PhoneGap, you can integrate your app with native cloud messaging. Here's a tutorial.
Push Notification can be implemented. If you are using Phonegap, PushPlugin ia a good available option. This plugin is for use with Cordova, and allows your application to receive push notifications on Amazon Fire OS, Android, iOS, Windows Phone and Windows8 devices. ALso it is free to use.
The Android implementation uses Google's GCM (Google Cloud Messaging) service.
For detailed implementation guide using Android refer Android section in this link.
Hope it will answer your question. this is late answer here, can be helpful to you as well as others looking for similar kind of solution.

Google Analytics not working in Webview in iOS app

Let me first start out by saying I know how to use the iOS SDK so please don't answer this with a "just use the SDK." I want to know WHY google analytics is not working.
Here's my setup. I have a web app that is also baked into an android app and ios app via webview. I'm using cordova. The android app works just fine with the GA JS code. The web works just fine. However no events or page views are showing up from iOS. I've heard that GA is tied to the domain so does an iOS Webview do something under the hood to the domain?
I was going to attach my code snippet but it's coffeescript in a few classes so I'll just paste the compiled js
Analytics.prototype.track = function(args) {
window._gaq.push(args);
};
Analytics.track(['_trackEvent', 'SubscriptionModal', "Closed", data]);
This works fine in web and android so it's not a JS. I'm setting the GA _setDomainName to 'focusatwill.com' and can see that both ios and web have a domain of 'www.focusatwill.com'
I've read online a few people talking about this issue and everyone says just use the SDK. I'm looking for the reason why it doesn't work. How do you fix it to use the JS?
edit
I should mention that the html and JS are not baked into the device, ie they don't have a local url but are served up from our webserver
Safari on iOS6+ blocks third party cookies by default, and I'm certain that webviews do too.
Check that you have something similar to the following in the init method of AppDelegate.m:
NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
That's from the standard boilerplate generated by Cordova 3.0.9, but might not be present if you're using a version that predates iOS6. It sets the app-specific cookie policy, which should override the system default.

Use JavaScript for sending/reading sms on Android phones?

I use PhoneGap for developing native apps on Android platform. Previously there used to be a Javascript function for doing that. But currently that function is not included in the their API. Is there a plugin or any another JS based API which I can use to send/read/delete sms on an Android phone.
Plus: Can I get access to the folder where the smses are stored on an android phone?
PS: I know the URI way of sending sms so that wont count as an answer
Is there a plugin or any another JS based API which I can use to send/read/delete sms on an Android phone.
There is no support in the Android SDK for "read/delete sms". You are welcome to write a PhoneGap plugin for Android that ties to SmsManager to send SMSes, though.
Plus: Can I get access to the folder where the smses are stored on an android phone?
For starters, there are many SMS clients, and so there are many different stores for the SMSes. I am not aware of any SMS client that offers an API for manipulating those messages. Certainly, the Messaging app from the Android open source project does not have a documented and supported API.
you can access the sms database if you have ("root") its etc/data/data/telephony/mmsm.db or something like that depending on your version google
directory of sms database in android 4.0 then you can use es file explorer or another file manager to access this database...
you can also view deleted sms in this database...

Categories

Resources