How to load remote webpage on Android Hybrid App(the easy way)? - javascript

I have decided to learn how to create Android APK on windows for personal/learning use (Not for Android Play).
My design plan is to load a remote HTML page on android app and allow user to click a few links and then app make a post request to an API to get m3u8 of the video and play it !I already created the HTML web page and have the API access.
So could you guys point me to a beginner tutorial/example and what software and tools I need and which one is easiest to start with (to achieve my design goal)? (I installed PhoneGap but not sure if that is the only tool I need and if it is the easiest path. So I wait for your advice).
Furthermore, does installing java JDK creates any security issues for my PC? (since I heard lots of bad news about Java in past few years.)

If you are going with Phonegap, I would recommend you to first read the phonegap documentation so you can setup a basic phonegap project (phonegap). I would recommend to implement the site functionality inside phonegap instead of just loading an external site; this way you have access to more phone controls than from a web browser. But if it is really a requirement to load the external site, basically, the phone gap would load an empty page that would load your external site using the cordova inappbrowser plugin, here is the github page of this project (inappbrowser).

Related

Solution for identify mobile devices by mobile browser

I'm wondering it's possible to identify android device by web app running on mobile web browser? And this solution have to still working after change or upgrade web browser on this phone.
My second doubt is web app can working offline on phone showing PDF presentations saved in local storage (disk). When I have internet connection I can manually sync presentations (some are removed and some are downloaded).
If PWA app can work like I described above or in this case we need to use (hybrid) mobile app ?
PWAs allow to cache assets and make them available to the users even when they are offline. There are some functionalities that only Native Apps have (eg. access to a device contacts), but they are very close under many other aspects.
I wrote an article about Service Workers and caching strategies where I explain how to cache static assets as well as HTTP GET calls. It is part of a series about PWAs, so you might find it useful to get more insights about this technology.
Have a look at the website what web can do today to have a list of WEB APIs currently available:
I do not know the detail of your requirements, but maybe you do not even need to implement an hybrid app and simply create a PWA.

Run JavaScript, jQuery, Ajax on PhoneGap Android App?

Is it possible to use JavaScript, jQuery and Ajax on a PhoneGap App for Android? And if so, how can this be possible? Because, when I run my index.html on Mamp, it works. But when I run it on my local machine, it does not work.
So my question is - will my project run on a PhoneGap App for Android?
And if so, how does this work? Does PhoneGap Apps have some kind of a integrated Mamp (or something like that), that emulates a webserver?
I have tried to google it, but can not find a answer.
I'm sorry, but I don't have a Wifi at home right now, so I got to wait some weeks before I can deploy my test on Android over PhoneGap.
I just would like to know right now, if it works or not - and when it works, how it can work.
Thanks!
Phonegap does not have integrated MAMP, it is not a web server. Think of it as more of a web browser -- PhoneGap only runs web assets like HTML, JS, CSS. You would then make your ajax calls to your MAMP server from your PhoneGap app to deliver data.
Just give it a try, PhoneGap has low barrier to entry and this will be the best way to see how it works.
Getting Started with PhoneGap.

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.

Using FileTransfer to download files in the background on a mobile application packaged with phonegap

I have packaged my jQuery/javascript application with phonegap for Android, and later plan to do this for iOS/BlackBerry. In this project, I implemented the FileTransfer.download function from the phonegap API to download a file from the server. The function is working successfully, but it blocks me from navigating to other pages within the app until the download is complete.
Maybe I'm missing something in the documentation: what's the best way to get FileTransfer.download to work in the background so that I can freely navigate page to page? Is it possible without resorting to device-specific code?
The solution I'm settling for is creating a plugin to call native code that does the downloading. In Android for example, I can create an AsyncTask to do the downloading in a phonegap plugin. I guess I'll be required to do something similar in iOS/BlackBerry/etc. Still welcoming others' solutions

Is it possible to get this facebook plugin working with pure phonegap app

This might be really a basic issue. I am kind of confused. I don't understand one thing. Phonegap app is pure html5 and javascript. But for this plugin (https://github.com/davejohnson/phonegap-plugin-facebook-connect/tree/master/example/HackBook) to work we need separate java code for android and xcode for ios.
I got the java version of the android tutorial working with the simulator but when I just copy the assets folder to build a pure phonegap app. it does not work.
Then it beats the purpose if i still have to maintain 2 code lines.
Does just the html and JavaScript code in this plugin is not supported by phonegap app without java or xcode.
Here is my phone gap app. you can download it. https://build.phonegap.com/apps/211586/share
My code in the git repositiry is here
https://bitbucket.org/sunmeet/phonegab2.0_fbapi
PhoneGap Build service only Supports ChildBrowser , Barcode Scanner, Google Analytics recently.
if you try to use any external plugin which needs assets other than HTML / CSS / JS, you can't use them with PhoneGap Build Service. But, PhoneGap Team are trying to push out different plugins like Facebook Connect in Future Releases.
So, here they gave two Options to Deveopers.
Use Child Browser and Do Process Facebook OAuth Authentication.
Build Locally.
Andriod developement environment is "Eclipse" IOS
developement environment is "XCode"(OS: MacOS)
I Suggest you to work with first option and once plugin is our from build service its really easy to integrate anytime.

Categories

Resources