How to download android app using .apk link directly from phone? - javascript

I have a list of .apk files on a webpage which I want to be able to download directly from my phone. So I should be able to navigate to that webpage and click the .apk link and it should download the app on my phone. Basically right now my web page is listing these apk files but if I try to click on one of the links using an android emulator, nothing happens. Any advice on how I can make these .apk links downloadable directly from the phone?

The emulator might not support downloads. I would try it with your phone, or if your webpage is not yet available find one that does have .apk and try it.

The emulator doesn't have any program to install apps like that. Here's what you can do though:
Download the app onto your computer and use adb to install it on your emulator, like so:
Download the apk to your computer to SOME_FOLDER
Add the platform-tools folder in your Android-SDK to your PATH. (this is the folder in your Android-SDK that has adb.exe)
Open up a command prompt and navigate to SOME_FOLDER.
Type "adb devices -l" and you should be able to see your emulator listed in the devices (your emulator already running, right?)
Now, type "adb install YOUR_APK_NAME.apk"
That's it. The last command might take upto a minute, or more. When its done you should see your app installed in the emulator.
For more details on using adb, please see here: http://developer.android.com/tools/help/adb.html#commandsummary

Related

I am unable to start up my React Native app on Windows using Android emulator from Android Studio

I am new to React Native and Mobile App Development. I am trying to start up my bare React Native project in my Emulator and it gives me issue to set up.
I get this error when I click on the button a to set to Android Emulator from my command terminal
Couldn't adb reverse: adb.exe: error: device offline
Couldn't start project on Android: Error running adb: device offline
please how do I fix it
here is my system variable
C:\Users\JUWONCALEB.DESKTOP-CMA289U\AppData\Local\Android\Sdk
running adb devices after running adb kill-server. Security question pops up after that. Worked for me.
1/ run npm start
2/ go to http://localhost:19002
3/ press on Lan and copy the URL under it eg. exp://192.168.1.3:19000
4/ download expo app in your device from your android studio.
5/ open expo and click Enter URL manually and paste the URL u copied in the previous step
6/ if needed: reload by clicking "r" button in your command line
Try to:
1 Launch the android emulator (any sdk is fine as any model)
2 open the settings IN the emulator
3 activate developer mode

Launching on android WEBAPP with ADB

Is there a method to launch a web app using adb?
The web app is created using manifest.json and save on android using chrome browser.
I've tried to get the package name of the web application using adb shell pm list packages but nothing seems to match.
I want to launch my web app this way adb shell am start -n com.package.name/com.package.name.ActivityName
I've also tried this way adb shell am start -a android.intent.action.VIEW -d "url". This works but it is not what I am looking for.
Assuming you are coming from Javascript world (as you could have done this by looking at adb logs), this should be what you are looking for
adb shell am start -a com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP -n com.android.chrome/org.chromium.chrome.browser.webapps.WebappLauncherActivity --es "org.chromium.chrome.browser.webapp_url" "{your_url}" --es "org.chromium.chrome.browser.webapp_mac" "{webapp_mac}"
Note that this url has to match the url/url-ending you have mentioned in the start_url that you have mentioned in the manifest.json of yours, else it will just open it as another chrome tab.
Another caveat here is you have to pass web app mac validation check, which is done by the core android class mentioned here - WebappAuthenticator
Chrome does not keep a store of valid URLs for installed web apps
(because it cannot know when any have been uninstalled). Therefore,
upon installation, it tells the Launcher a message authentication code
(MAC) along with the URL for the web app, and then Chrome can verify
the MAC when starting e.g. {#link #FullScreenActivity}. Chrome can
thus distinguish between legitimate, installed web apps and arbitrary
other URLs.
I gave it a shot to open one of the webapps I own. I gave up after a bit, getting lost in the cryptic algos. Maybe you will have some luck with it. All the best!!!

How can I publish to the Apple app store my expo application?

I have finished to write a react-native application written with the help of expo SDK and I want to build my final .apk and .ipa for testing them with real devices.
During the development, I have used one iPhone 6 and one Galaxy S9 real devices using the expo application.
So far, I managed to build from Debian the signed apk but I didn't find a way to get an .ipa from my Debian linux system.
I can't have xcode installed but if needed I can rent a mac online and submit the ipa from there.
I have already followed those guides:
https://docs.expo.io/distribution/building-standalone-apps/
https://docs.expo.io/distribution/app-signing/
https://customersupport.doubledutch.me/hc/en-us/articles/360001189514-iOS-How-to-Create-a-Distribution-Certificate
This guy says:
Is it possible…sure. The only thing a Mac is needed for is XCode for actually uploading your IPA to AppStore. I do not own a MAC personally, so I rent an online one via MacInCloud.
What are the steps to build an .ipa on expo?
This is super simple if you are using the managed workflow (not sure if this is the case?).
expo build:ios
You will then get a link which will allow you to download the .ipa once it has been built on the expo servers.
Open your MacInCloud mac, download the .ipa from the link provided, and then upload it to the AppStore using the Transporter app.

React native application release build install on Simulator but not on device

I have done all provisioning profile setup on excode with manual Provisiong profile and my build is succeeded on xcode also running on simulator with release build but when I create ipa file and its not installing on device almost on 75% its stops and nothing happen.
My Xcode version is 9.2 with iOS 11.2 I'm installing on iOS 12.1.2 iphone device. Is anything I'm doing wrong?
https://www.raywenderlich.com/120-how-to-submit-an-app-to-apple-from-no-account-to-app-store-part-1
For provisioning profile and generate certificates + add App ID with UDID I have done exact procedure.
If you're signing your ipa file using an AppStore certificate, you can't install it directly on your iPhone without passing through Apple's review or AppStore first. So, maybe there's two solutions for your problem:
Build your app as Release and sign with a Development certificate; or
Sign your release app with an Ad-Hoc certificate;
Furthermore, Ad-Hoc certificates enable you to install your live app directly into a limited number of devices without passing through AppStore. I think that's what you want.
See more on Apple's site.
And there's also this link.

How can I tell if my Cordova application is running on a simulator or real device?

I'd like to be talk to a different server when running in an emulator / simulator.
It looks like device.platform used to mention the simulator, but know it just says "iOS". The user-agent doesn't seem to differentiate either.
Ideally the solution would work for all platforms, but I'll take Android and iOS, or in fact anything helpful!
For iOS I just check the model - if matches /x86/ then it's the simulator (until Apple release an Intel iOS device).
function isRunningInSimulator(device) {
// Only valid after deviceReady
return device && device.model.match(/x86/);
}
In the most recent version of the Device plugin (https://www.npmjs.com/package/cordova-plugin-device), there is now a isVirtual property that represents this.
I don't know if it is possible to detect. One "workaround" is use a task manager (grunt, gulp, whatever) to copy configuration files from on folder to other. Then instead of running "cordova run android" (example) at the command line, you would run a task that copies the config file(s) from one specific folder (i.e.: development or production) an the application read the copied file.
You can take a look here http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/ at the section "Replace Text Depending on Environment"

Categories