- accessing Android API from browser
- 1 Answer 1
- How to Access Android Phone from PC?
- Access Android phone from PC in three ways
- Method One: Recommended Method to Access
- Method Three: Access without Assistant Tools
- Access Android Files from PC in 2 Ways
- Access Android Files from File Explorer on PC
- View Android Files on PC from DoTrans
- How to access android browser’s local storage via native code
- 2 Answers 2
- 3 Android Browsers With Extensions Support To Install Your Favorite Extensions
- 1. Kiwi Browser
- 2. Firefox
- 3. Yandex Browser
- Bonus
- Ending thoughts
accessing Android API from browser
I understand I can call android native APIs from javascript if I use an embedded WebView.
However, is it possible to access these APIs from a regular browser in Android, such as Firefox Mobile or the stock browser? I assume I would have to explicitly grant permission somewhere, as otherwise this would be a big security hole.
I’m having trouble seeing the use of creating a special app that runs javascript; my app is a regular web app running off a server (not embedded in my android app) and is updated frequently (therefore not suitable for embedding in an app) and in some cases it would be useful to add the ability to query various information directly from the web page, mainly to prevent Android from killing the browser and forcing a lengthy reload of the web app upon re-entry just because I had to take 5 seconds to jump out of (e.g.) Firefox to get the info manually.
1 Answer 1
I don’t think there is anyway you can call your Android APIs from a regular browser (they do not have them as part of the DOM model), unless you build specific extensions of your own for each browser. That would be tedious work and probably not worth it, since that is exactly why Embedded WebViews exist (like Phonegap).
Now, you can always try do the other way around, which is load your web page from a WebView right from your server. By default, webviews load their content from the local storage of the device, however, using XHR you can call your traditional web pages and show them in the webview.
This can be achieved using either divs that can embed a piece of content from your server or iframes to fully load entire pages from your browser. The second approach will be more transparent since you can fully reuse your current web pages, however it will prevent you from communicating your wrapper with the web page, due to cross origin issues security constraints. I would suggest the first approach, although you probably will have to refactor your server web pages to make them integrate better with your application.
This would work like this (for simplicity in the examples I am using JQuery, but you could do it directly using XHR):
Источник
How to Access Android Phone from PC?
Nowadays, people are obsessed with Android smartphones. people spend time tweaking with their Android on many occasions including a walk with it, sit with it, eat with it and toilet with it. It sounds to be exaggerated, but the fact is that we use smartphones to take a selfie, listen to music, watch videos, play games and etc. By accessing Android from PC, you can manage the files stored on your phone more efficiently. But how? Just plug the USB cable in the computer? Definitely not. Here are three ways to help you get this done.
However, you may have learned about USB debug mode on your phone which is the most common means to connect to computer. USB debug mode is a function for Android developers in the early times which allows them to control Android through the PC. Android has open-source code, which means users can freely access to open USB debug mode whenever they want now. You can activate the USB debug mode by using a cable, let’s check for it in the first method.
Access Android phone from PC in three ways
Method One: Recommended Method to Access
The first way is to access Android files from PC via USB cable without other tools is by using ApowerManager. It is a one-stop management tool that allows you to access Android from PC so that you can manage phone pictures, music, videos, apps, etc. Follow the guide below to learn how to operate.
- Open the USB debug mode and plug the USB cable in the computer. Remember to change the USB connection mode to MTP or PTP. At this time, a prompt will pop up at the lower right corner of your computer saying “Installing device driver software”. Wait until the installation finishes.
- Launch the phone manager to connect your Android to your PC. Then you can access Android files from PC.
Did you know? ApowerManager not only can access Android from PC via USB cable but also via Wi-Fi. For Wi-Fi connection, you should install an app on your Android first. Then you can scan the QR code or enter the verification code to build a connection. Moreover, as it is a one-stop management tool, it possesses lots of management functions, like contacts, messages, screenshots, backup and restores.
Pros: One-stop management. Fast connecting speed. Support various kinds of Android phones. A simple interface and easy operation.
Cons: The trial version only available for three days.
Method two:Method two: Access through Official Phone Driver
The second method is using the phone driver which the smartphone enterprise or Third-party provides, such as Samsung and HTC driver. The driver will help you access files on Android from PC. Here I take Samsung Kies and HTC Sync Manager as examples to talk through the instructions.
1. Visit Samsung official website to download Kies.
2. Install and launch it
3. Open the USB debug mode of your phone and then plug in the USB cable to access Android phone from PC.
1. Navigate to the official website of HTC, find the mobile driver and download it. The driver would be in the Support Center.
2. Install it and then launch the driver.
3. Open USB debug mode on your Android. Plug in the USB cable to access Android from PC.
Pro: Provide professional service to a certain kind of Android phone.
Cons: Complicated to use. Slow connecting speed.
As you can see, there’re special drivers for corresponding models. But you have to install two drivers for transferring files between two Android devices in different brands. Some of the drivers are glitchy, it occurs to me that the connection sometimes fails due to unknown reasons.
Method Three: Access without Assistant Tools
First, open the USB debug mode and plug in the USB cable.
- If you want to manage files in the SD card, change the connection mode to USB storage.
- If you want to manage the files in the internal memory, switch the connection mode to PTP.
Second, after successfully connecting, you will find your Android device appears as a portable device in “My computer”.
Pros: Access Android device from PC without installing any software.
Cons: You cannot preview the files or to manage them efficiently like working with a software. Sometimes, it is hard for some Android phones to connect to PC.
Comparing with three methods above, the method of using Apowersoft Phone Manager is highly recommended. The reason is that the phone driver only compatible to certain kind of Android phones and the second method cannot access to the Android files in the internal memory and SD card at the same time.
Источник
Access Android Files from PC in 2 Ways
Having access to your Android files from PC is not difficult as it was once. All you need is your Android phone, your computer and a USB cable to connect devices. This article is going to introduce two ways of viewing Android files on Windows PC. If you don’t know how to see files on Android from PC, read on to learn more.
Content
Access Android Files from File Explorer on PC
The most common way to access your Android files on PC is by connecting your phone to the computer with your Android’s charging USB cable. After detected, you’re allowed to view phone files from File Explorer on Windows PC. Here’s how to do it.
1.Connect Android phone to the PC
Plug the USB cable into one of your computer’s free USB ports. The other end of the cable should be plugged into your Android’s charging port.
2.Allow PC to access your Android
Unlock your phone when prompted and enter your lock screen password. And next tap Allow or OK If you receive the notification asking if you want the computer to access your phone data. If you don’t receive the message, swipe down from the top of the screen to open the notification bar and check the MTP(Transfer files) option.
3.Open File Explorer
Click This PC on the desktop, and double-click your Android’s name under the Devices and drivers.
4.Browse your Android files from PC
To open your Android files on PC, just double-click the folder. For example, double-click the Music folder will display a list of your Android downloaded songs.
View Android Files on PC from DoTrans
Viewing Android files on PC with File Explorer is limited to media files. To have a more detailed view of your phone files, such as contacts, messages, or to make changes to your Android, you can use a transfer tool called FonePaw DoTrans.
FonePaw DoTrans is an expert in managing files among iOS, Android and computer. It allows you to view some files that you can’t access with File Explorer, such as contacts and text messages. Besides, it is quite convenient to find certain files because your phone files will be presented according to the data type. You don’t need to search what you need by opening the file folder one-by-one. Other features like a one-click backup and restore, finding duplicated contacts and making ringtone is also supported.
If your Android device can’t be recognized by the computer or it doesn’t appear in the File Explorer for no reason, try using DoTrans to access Android files from PC.
Step 1: Connect Android to PC
Run DoTrans on your computer and then connect your Android phone to it. On the Android device, enable USB debugging and select MTP mode for USB connection.
Step 2: View Android Files from DoTrans
When detected, some basic info of your Android phone will be presented on the interface. In the left menu, you can see a list of data types, such as Music, Photos, Videos, Messages, and Contacts. Click one of them to see the detailed files.
If you want to export phone files to PC, simply tick the ones you want and then click Export to PC. Or you can also copy files to your Android phone from the computer by clicking the Add File(s) button. Moreover, you can transfer Android files to another phone by clicking Export to Device.
Источник
How to access android browser’s local storage via native code
I am developing an android application that has to access the default browser local storage. The scenario is :
- Open the android default browser
- Load a page (that I have developed) that saves some data in the browser’s local storage
- Close the browser
- Open my application
- The application reads the data saved in the browser’s local storage and shows it to the user
Is there a way to access the local storage of the browser? Also if it is possible, how to access the local storage of the other installed browser on the device?
2 Answers 2
It seems that there is no way to achieve this. I have tried to access browser’s data using content providers but you can access only bookmarks and history.
I have also made some tests using WebView instead of browser. I tried two approaches:
- Access the local storage database
You can access the local storage database like normal SQLite database. The data is stored in a single table with two columns — key and value. According to the javascript documentation writing to the local storage is a synchronous operation. This is great! The problem is that persisting the data from the browser(webview) to the file system is asynchronous. So if you write something to the local storage it is stored in the memory so it is accessible through javascript API but it is still NOT persisted to the SQLite database.
- Access the local storage via javascript bridge
Источник
3 Android Browsers With Extensions Support To Install Your Favorite Extensions
On desktop, almost all the browsers support third-party extensions, either their own or borrowed from Chrome web store. However, on Android phones, only a select few support extensions; not even Chrome for Android supports extensions. Not to blame browser developers, porting desktop extensions to mobile isn’t an easy task. Either the browser developer will have to create new mobile friendly extensions or convert desktop extensions which may not work properly.
Well, even though it’s a bit difficult to get extensions on mobile, there are a handful of browsers that actually support extensions. They might have limited catalog or have extensions with limited functionality, but they will surely make your browser experience better with vast customization options. Let’s check out 3 Android browsers with extensions support.
1. Kiwi Browser
I have previously written about how Kiwi Browser can help you run Chrome extension on Android , and it deserves a mention here as well. Kiwi Browser is a Chromium based browser that lets you download Chrome extensions from Chrome web store. Of course, not all the extensions will work properly, but most extensions work fine (at least in my experience).
Just tap on the main menu and select the “Extensions” option from it. You can then tap on “Google” to open up the Chrome web store desktop version to browse the extension. If you find an extension worth downloading, tap on the “Add to Chrome” button to install the extension in Kiwi Browser.
Kiwi Browser also comes with a bunch of other interesting features like ad blocker, tracking blocker, cryptojacking protection, dark mode, and much more. Best of all, it’s open source too.
2. Firefox
Firefox also lets you install some of the popular extensions. Unfortunately, the number of Firefox Android supported extensions are very limited, but all of them work perfectly. Most extensions are privacy focused, such as HTTPS Everywhere, Privacy Possum, and Decentraleyes, etc. You can tap on the “Add-ons” option in the Firefox main menu to see all the compatible extensions for your phone.
I am sure you already know Firefox is a privacy focused browser, so it’s Android variant comes with the same privacy respecting features. You can natively block trackers, quickly delete data stored, and fully customize Firefox look.
3. Yandex Browser
Yandex is another browser on Android that borrows extensions from Chrome web store just like Kiwi Browser. To access the extensions, tap on “Settings” in the Yandex main menu and then tap on “Extension catalog” at the bottom. This will open the extensions list with 3 extensions already installed. You can tap on the “tune-frame” button at the bottom to search Chrome web store and install extensions from there using the “Add to Chrome” button.
Yandex too comes with some interesting features like built-in ad blocker, wallpapers, account sync, unknown WiFi protection, and much more. I personally really like its built-in reader mode that strips off all the unnecessary content and only shows text and related images, making reading web articles very easy.
Bonus
Apart from these 3 Android browsers with extension support, you can also use the default Samsung browser if you have a Samsung phone. The Samsung Internet browser also comes with some add-ons to get extra features, you might find your required extension there.
Ending thoughts
I will personally recommend you to give Kiwi browser a try as it’s very light weight and comes with all the required features. Although if your required extension is available on Firefox, then that would be best for you as all it’s extensions are tested for Android and Firefox is a reputable browser.
If you know any other good Android browser with extensions support, do let us know in the comments below.
Источник