Prompt to turn on device GPS in PWA - android

After going through tons of literature related to Geolocation in PWA, I am not sure whether this is possible but is there a mechanism for prompting the user to turn on device GPS in PWA?
What I am hoping to do is a solution similar to https://ionicframework.com/docs/native/location-accuracy/.
While the decision to turn on GPS is with the user, a prompt will help them to easily make the decision. I have gone through lot of tutorials and docs but haven't found anything yet. Please share your thoughts.

You can show a prompt that explains the benefits if you activate the geolocation, and if the user agrees there to make the request for geolocation in the background.
If your intention is to implement it on the web, you could check this plugin also that is compatible with Native and PWA.
https://ionicframework.com/docs/native/geolocation/
More info: https://developers.google.com/web/fundamentals/native-hardware/user-location/

Related

Controlling GPS ON/OFF from the app

I am seeking for some advice from the Corona experts. I would like to control GPS ON/OFF from my app but I am not quite sure that can be achieved by using Corona.
I have couple of queries about the process-
After installing the app and then open, the app will prompt for enabling GPS (if that turned OFF on that device and sharing location permission is already given), am I right?
If the sharing location permission denied by the user then can the app will be able to ask for permission again and prompt for enabling the GPS?
If I turn ON the GPS from my app settings and then again turn OFF, then it is possible to show popup notification message to turn on the GPS?
Someone said that it only display the permission notification prompt message once and after that no way to show the prompt message to control the location service.
Looking forward to get some expert advice.
Thanks in advance!
You cannot do any of these with Corona SDK. You will need Enterprise version to play with permissions and settings. Even then you have to code in Java not Corona.

How to detect Cordova / Phonegap app network connection is roaming

I have not been able to find this in the Phonegap/Cordova docs. Is there a way to tell whether a network connection type is roaming? I want to allow the user of the app to constrain the application to only allow data transfers of a certain type (Data intensive) when on their own network and not roaming.
network = navigator.connection.type only gives you the type of carrier data connection (Or even just CELL on iOS) but nothing about whether the user is roaming.
Many thanks
Ok. In case anybody else comes looking for the answer to this. It seems based on research elsewhere and also what jcesarmobile said, you can't detect this on iOS anyway so that would explain why there is nothing in Cordova for this. While my primary platform for the app is initially Android and it might be possible to create a plugin for that, the ultimate goal is to be multi-platform and there won't be this facility in iOS so for our project we'll drop the requirement.

Enable data connection on android system app

I'm trying to make a android system app (for me and friends), to let me control my android phone over my server.
Actually I've problem to enable/disable data connection. When I search, I found topic that said there is no possibility, or giving a no longer supported way (by using breach). This was exactly the same for GPS controle, but I found a way because my app is a system app.
So I want to know if someone know a way to enable and disable data connection without user consent on a system app. I didn't find anything on the api.
Thanks !

Activate GPS from server-side app to an Android app

While i was thinking about GPS and server communication in an Android app, i though it would be really interesting give a turnaround, activating GPS from server-side app to an Android app. Is there a well-documented way to achieve this?
I found this answer about using C2DM but they don't provide too much information about.
C2DM is a bit of a black art -- best tested using curl -- but once your application successfully receives a message, you can respond to it in whatever way you like -- including starting GPS, etc
You can do one thing, in client-server communication, send some tag to client that GPS should be enable, and from Client(phone) if this tag is true, enable GPS, or start getting location update.
this is how i achieved the same in my app.

Use Android GPS to detect and connect with other phones

So I asked something similar yesterday and did receive an answer to my question, however I don't really think I asked it correctly and therefore didn't receive the exact information I needed.
I'm in search of an API, some open source code, or even just a way that someone else has achieved this on the Android. I'm making an app that needs to find all other Android devices within a specified radius. For example, when you open your Android Google Maps App, and you search for say "Restaurants [ZipCode]", it uses a radius modified from your zip code and finds all of those places. The GPS gets YOUR location, and maps uses that information to find restaurants within an address close to that passed in location.
Instead, I want to be able to use the GPS to find my location (as it can now easily), but instead of finding things on a map (which is already built in), I want to be able to find other GPS enabled Android phones. I get that they will have to be broadcasting their GPS signal at the same time as well (since they don't have their data stored with some sort of central database as a restaurant would). However, I don't just want to FIND these phones, I want to send/receive data from these phones (with correct permissions obviously).
Now, I've found things like the Bump API. However, BUMP uses the phones sensors to spark this search. So basically, if you "bump" your phone with another and have the app running, it will THEN go ahead and use GPS to find the location of the other phone you just bumped with and exchange data between them. This is like EXACTLY what I want to do however in their API, they do not provide the functionality to just say, "Hey, give me all phones within a mile from me."
I've also found API's that can do exactly what I need but they have to be on the same Bluetooth range or on the same Wi-Fi network, which doesn't suit what I need at all.
Do you guys know of anything that can fit exactly what I need that already exists? Or a way to maybe modify Bump API (if you've done it), to not have to use the phone sensors and find phone information directly through GPS for phones around you? Or is there something that exists over a 3g/4g network instead of only wi-fi/Bluetooth?
Thanks guys.
Instead of frequently posting locations to an external server, couldn't the GPS realize other things broadcasting a GPS signal at a very specific time and send/receive data from them?
The only things that are "broadcasting a GPS signal" are satellites.
We would like to accomplish this without the use of an external server.
You have no choice but to use an external server, whether you like it or not, both for discovery and for later communication.
Do you guys know of anything that can fit exactly what I need that already exists?
Foursquare, Google Latitude, Yahoo Fire Eagle, and so on.
To do this via GPS, you would have to have all the phones frequently posting their locations to a network server, which could then inform them of others nearby.
Needless to say this would be opt-in only!
And it may have negative consequences for battery life, unless you make it update infrequently, which may limit its usability.
The advantage of having an explicit trigger action to both phones is that they only need to query the GPS and inform the server to find each other by location when they've both been triggered.
You would probably have to author your own application - then you could do this server-side and push things. If you're trying to push data to random Android phones - you're out of luck. Most people aren't going to want this, and probably aren't going to have the apps necessary to receive and understand it. With Bluetooth networking you'd need authorization, and most Androids don't have a capability to transfer random data by Bluetooth out of the box (though you certainly can get software to do it).
Honestly, malware and tracking are the reasons this really isn't possible, but even if they weren't, you would still need an application on the receiving devices that understand what you're sending them. And if you're widely spread enough, you'd probably want to send it to a server to disseminate anyway (for the transmitting phones bandwidth costs at least).
Develop a server application that your android app logs into. Send the GPS location every time the phone moves over a present distance. Either send a query request to the server to ask it if any other phones are in range, or get the server to inform the phone of a new device in range.
You may run into server scalability problems, so thats something to think about.
Also, this would be a big battery drain, and so your users may not be too keen to run it, not to mention the privacy element.
You need to rethink what you're trying to do. Android devices don't "transmit" any GPS signal, they are simply receivers, with signals from satellites. So the phone can easily get a location for itself, but the location of other devices is very, very private information. To get access to location for other phones, you either need to be on the same network as them (bluetooth, wifi), or you need them to use a server-based service to send locations to, like Google Latitude.
I'd be highly unlikely to sign up to a service like that. My location is very private, I share it with some people, but I cannot seem myself openly sharing it with an app, without a very, very good reason.
It seems to me that you need to build a server-based application, e.g. on Google App Engine, have people sign up, and agree to their location being sent to that server, so other phones running your app can access that information from the central store.
The question now has a very simple solution to it. All you have to do is set up a Geofence and monitor it for entry and exit of users. Geofence allows you to choose a geolocation and set a circle of desired radius around it. When someone enters or exits the location you can get notified and perform desired action.
Visit this link for further details on how to use this in Android.
All the comments from other folks about not being able to pick up the signal from others phones are correct. There is a completely different alternative system however in the network based location services. This is a model where you ask a carrier network for the location of a handset, which the carrier network needs to track for enhanced 911 service in the US (I'm unaware of how widely deployed this is in other areas, and how many different services you would need to use to cover other areas).
It's potentially a very expensive route however. And it won't just automatically work for all handsets, I believe the users will have to be opted into sharing location with your service. This is how services like Loopt had initially setup their location info so that it could be passively collected without negatively impacting handset battery life. There are some third party services that front for a cross-carrier service such as Location Labs:
http://locationlabs.com/
As well as third party location services like Skyhook Wireless, who might be able to get you some info of the sort (though I don't think what you're looking for maps to any of their existing APIs)

Categories

Resources