Install a progressive web application (PWA) on the phone without a network - deployment

Is it possible (e.g. when developing) to send a pwa to the phone someway e..g. via usb cable without the network and serving it in https?
The use case is development, when maybe a wifi network is not available or unpractical to set up.

If your APP is fully PWA compliant, the app added to home will be an installed APK, which you can extract using file explorer(I used ES File explorer) and put it in other devices using USB connection and adb install myapp.apk for installation.
After you load the apk, it would anyways make calls to your web-server which I'm not sure how it make sense to achieve without network connection though. I couldn't think of any reason to develop a mobile application as PWA without network. You can even have a pass though internet(sharing your desktops internet via USB) by connecting via USB if wifi is not available. But developing PWA with absolute no network mode is not practical.
Update: While you can generate the APK and side load it via USB in the above mentioned way, transferring the cached assets(HTML/CSS/JS/images) might be tricky. You may have to wrap your app as a plain cordova application or Ionic kind of PWA app which uses Cordova to wrap and build with your assets. This way, your APK will be having everything it needs to run for calculator kind of use case.

Related

How to use proxy in Wi-fi setting for the app in Flutter app?

Case:
I use Flutter to create an app, and the app will call Restful Api to backend server to get data.
However, the backend server only open to a selected host and port for security reason.
The app works well if it is under that network, but cannot works properly because of fail to get data if out of that network.
As a result, I would like to setup a proxy for the wi-fi I'm using, and run the app as normal.
Unfortunately, the flutter app still not working in both Android and IOS platform.
Question:
How to use proxy in Wi-fi setting for the app in Flutter app?
You may try using this package to apply the system's global proxy settings: https://pub.dev/packages/native_flutter_proxy
Dart's networking tools don't pick up these settings on their own.

Can we run a Capacitor PWA app offline?

i just created an Ionic project and i added capacitor on it ( with a "npx cap init" ), i set up my service worker ( i just left the <--- ...... ---> in my index.html ). Then i run " ionic serve " from my laptop, and i tried to access it from my mobile phone ( so basically i did a personnal hotspot with my mobile internet, i mean my laptop and mobile phone have the same internet connection ), and it works.
I can access to my ionic app from my mobile whereas it is runt on my laptop, but now i'd like to add/download this app on my mobile phone and use it offline.
Do you know any way i can do that ?
Thanks a lot !
Capacitor works by serving your static assets (like javascript and HTML) from a self-hosted web server, whose behavior is dependent on your capacitor.config.json. This behaviour is most obvious if you look at the source code.
If you have server.url specified in capacitor.config.json, Capacitor's self-hosted server will act as a proxy for the server you point to.
If you do not have server.url specified, Capacitor's self-hosted web server will serve the files that were bundled with your native app.
Based on this, when you are creating the build for your phone, you will need to remove the server url property from your capacitor.config.json. You may also need to generate the capacitor.config.json on the fly in order to separate your development and production needs.
Note that the Ionic Framework and Capacitor have two completely different deployment paths; this answer assumes that you use Capacitor to create your builds.
Of course you can make an app and install it on your phone - that is basic purpose of Capacitor. Docs for android, docs for ios
Steps are similar to this (example for android):
Install Android Studio
At capacitor.config.json define techSupportEmail
npx cap add android
npm run build && npx cap copy android && npx cap open android
Enable developer mode on your phone
Plug your phone in
In Android Studio choose your device and hit "play" button

Is there anyway to use on-screen keyboard with ionic serve?

I like to use ionic servecommand for quick changes I know nothing better than actual device for developing. But I would really like to use just the on-screen device keyboard instead of my computers hardware keyboard, is this possible? I searched in ionic forums and online with no success.
It is not possible, but other option is to use this command (change platform according to your requirement) : ionic run android -l -c
This will run application in you mobile but same like ionic serve, any change on your computer will refresh application in your device.For this your mobile and computer should be on same network. Plus keep mobile connected through usb port while you are running application on mobile. Because all resources are served from computer.
See this answer for more detailed version.
Here is documentation link to live reload app feature of ionic cli.

Running Instagram on AVD

I wanted to use Instagram on my computer, so I decided to use an Android Virtual Device for that task.
I downloaded the Android SDK and the newest apk for instagram for my computer.
Then I created a new AVD and ran it. After it was booted, I installed the instagram apk using adb install instagram.apk.
It installed smoothly and after clicking the app, it started.
Now here's my problem: From there on nothing works.
When I try to login and I press the login button, nothing happens like there would be no internet connection.
Browsers and other apps using an internet connection work just fine, just instagram doesn't work.
How can I fix this?
I think it has something to do that the android Emulator can't really handle a global proxy.
Therefore hostnames get resolved directly to their IP which violates HTTP 1.1 standarts and the request doesn't get send properly.
To fix this, it is needed to change it so the hostname gets send instead of the IP.
You should try creating an AVD with different settings. More RAM and allowing GPU emulation is a good idea. If you insist on using an AVD and you have an appropriate intel CPU then you can make the emulator run much faster by following these steps. They are a bit complicated, but worth it if you want the emulator to run quicker.
I typically try to avoid using the Android emulator while I am developing apps. It has its uses, but it tends to be slow and doesn't have all of the capabilities of actual devices.
As an alternative to using an AVD, I would recommend downloading and installing BlueStacks. BluesStacks was written from the ground up to allow running Android apps on your Windows PC or Mac. I have used it before and it does a great job. Much better than an AVD.
Try visual studio emulator for android. Instagram works on it with enabled and connected wifi. This emulator works better than BlueStacks.

Debugging Servlets in Eclipse

I have created a web application using the Google Web Toolkit that is able to receive some data by a mobile client via Http Post. The transmission of the data works well and also the server / client communication using GWT RPC is no problem at all.
However, I need to debug the webserver when receiving data from the mobile device. As I am using Hibernate and MySQL within the web application I do not use the Google App Engine. So if I deploy the web application in local host mode it is only accessible on the localhost:8888.
Now, if I send data from the mobile phone, I have to send it to the locally assign IP address as the localhost of the mobile phone emulator is not the localhost of the computer, where the web application is running. To ensure that everything works, I tried to do some posts outside the emulator (on the machine the emulator is running on). This works, but how can I post from the emulator to my web application?
How can I get access to debug my system? I've already tried to deploy the final application to a tomcat server and use remote debugging, but that fails too.
Best regards,
Florian
Well if I understand your question correctly, the real problem isn't debugging the app on the servlet, the real problem that you're looking at is debugging from a mobile phone. When the mobile phone hits your local network (I'm guessing you're pointing at 192.168..?) you are accessing the compiled GWT code that does not communicate with the debugger.
Put another way, when you debug locally using a browser, you are actually not running compiled GWT code, but instrumented code that is executed with the GWT Debugging Plugin, that happens to work exactly like compiled GWT code. (mostly). So while your local version has "?gwt.codesvr=127.0.0.1:9997" or the like, your mobile phone version cannot do the same, and cannot thus communicate with the debugger.
The best that I've been able to do is to use logging extensively. If you're using an iOS device and change the settings are your safari, it can output logs for you from mobile safari. Also, if you're using the Android debugger with a WebView app, you can attach a listener for log messages and then ferry them on to the ADB and view those in Eclipse. Definitely not as good as a debugger, but that's the best I've come up with so far, and if anyone has a better solution I would love to know it :)
Hope that helps!