Cordova

70 views
Skip to first unread message

Kerstin Schneider

unread,
Apr 10, 2014, 6:45:55 AM4/10/14
to phon...@googlegroups.com
Hi,
my question: is it possible to make a Cordova app without internet access?
Thanks for help:)

Paul Libbrecht

unread,
Apr 17, 2014, 7:21:35 AM4/17/14
to phon...@googlegroups.com
Hello Kerstin,

I've actually tried the app you provided me and simply adjusted the file platforms/android/AndroidManifest.xml to comment out the permission element which was stating full internet permission. I than ran build
It worked for me on my Xoom tablet (Android 4.0.4), while, of course, MathJax did not get executed since the network was not used (I think there's an easy solution there).

What's more surprising is that it failed on my HTC Desire HD (Android 2.3.3). Could there be some "subtle" changes between 2.3 and 4? I think we should test this around… but I have no other 2.x devices around me.

The Manifest file is here:
I'll note that the permission element i had commented out actually got removed as if an XML parsing took place and zapped it.

If you agree, we could share the APK on the web so others can see it?

paul

Paul Libbrecht

unread,
Apr 23, 2014, 6:44:11 PM4/23/14
to phon...@googlegroups.com
What's more surprising is that it failed on my HTC Desire HD (Android 2.3.3). Could there be some "subtle" changes between 2.3 and 4? I think we should test this around… but I have no other 2.x devices around me.

So… PhoneGap gurus, is it normal to remove this element? Should I rather make this element empty?

thanks in advance for your help.
It really makes sense to write apps that are meant to be used at schools in a way that they are offline-able!

paul

Paul Libbrecht

unread,
Apr 23, 2014, 6:48:33 PM4/23/14
to phon...@googlegroups.com
(changing topic to make sure this is classified)

Appsotutely

unread,
Apr 25, 2014, 8:49:21 PM4/25/14
to phon...@googlegroups.com, paul.li...@googlemail.com
Yes, if you include all the code and resources you need in your www folder, it's entirely possible to create an app which has no need to access the internet.  It's equally possible to create an app that detects if an internet connection is available and to switch between an offline mode and an online mode.

Perry

Paul Libbrecht

unread,
Apr 26, 2014, 5:40:19 PM4/26/14
to Appsotutely, phon...@googlegroups.com
Thank you Perry,


Yes, if you include all the code and resources you need in your www folder, it's entirely possible to create an app which has no need to access the internet.  
It's equally possible to create an app that detects if an internet connection is available and to switch between an offline mode and an online mode.

I think the crucial thing here is to avoid asking the user to use the internet.
Fallback in case of no internet seems rather well covered thus far.

Is it the right thing to:

 adjust the file platforms/android/AndroidManifest.xml to comment out the permission element which was stating full internet permission

?

Is there  a way to make this work with Android 2.3?

thanks in advance.

Paul

Appsotutely

unread,
Apr 27, 2014, 11:42:19 AM4/27/14
to phon...@googlegroups.com, Appsotutely, paul.li...@googlemail.com
Hi Paul,

You are free to remove the permission element for "android.permission.INTERNET" from the AndroidManifest.xml.  You'll also want to go to the www/config.xml file and remove the element for <access origin="*" />.

I built a quick test app that has two input boxes and a button and the code to multiply the two and display the result.  I altered the:
   <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />

to have minSdkVersion="8" (versus the default build of minSdkVersion="10") and then I deployed that to an Android Virtual Device running Android 2.2, and it ran fine.  Your HTC Desire HD running 2.3.3 is a targetSdkVersion of 10, so the defaults should have been fine for you.

I'm a little unclear on what you aim is when you say "I think the crucial thing here is to avoid asking the user to use the internet."  Are you trying to make sure you block all avenues for accessing the internet?  If your app never tries to access the internet, even if it had permission, it wouldn't ever ask the user to use the internet. Locking down your app in the manner above will also prevent you from ever collecting any analytics about your app or from even presenting a direct link to a URL for support questions.

Perry
Reply all
Reply to author
Forward
0 new messages