Fetching Location from Android Wear LG Urbane 2nd Edition - wear-os

I am trying to write wear app. I see that if the phone is not synced with watch through Android Wear app (Eventhough the watch is connected with wifi after disconnecting from Android wear app in phone), Maps app does not pick up the current location.
LocationUpdates are NOT fetched when tried as standalone app in both the ways. Below is the code.
LocationServices.FusedLocationApi
.requestLocationUpdates(mGoogleApiClient,locationRequest,this);
LocationServices.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this);
But the above code works perfectly fine with Mobile app.
I am using LG Urbane 2nd edition.
Anyone please help me with this.. LG Urbane 2nd edition says it has GPS then why I am not able to fetch the location details when NOT Synced with phone.
UPDATE:
I found from the following sites that Android wear uses the GPS provider from the phone to get the location updates. Only Sony Smartwatch 3 can fetch the Location updates directly from watch. Is it still the same?
http://www.computerworld.com/article/2919013/android/android-wear-on-wi-fi-using-a-smartwatch-without-a-phone-nearby.html
http://android-developers.blogspot.com.au/2014/10/gps-on-android-wear-devices.html

Update: LG Urbane 2nd edition does appear to have GPS even though it isn't listed in their official site. Ignore the comments on that page as well that claim it doesn't.
Wear will use a GPS chip if there is one on board. This isn't just the case with the Sony device.
Regarding the FusedLocationProvider, if you run it on a Wear app, it tries to get the location from the phone b/c it is better on battery among other things.
If the Wear device becomes disconnected from the Phone, then it switches to the GPS on the watch (if it is there). Important, GPS doesn't work inside when on just the Wear device, so you may need to go outside. Also, it may take a moment to get/update the satellite locations the first time you use GPS on the Wear device.
If it isn't, it just returns the last known lat/long position when you were connected to the phone.
There is quite a bit more code involved with the FusedLocationProvider than we see in your snippet.
If you want to see a fully working Wear app using Location (both when connected and not), have a look at the Google sample on GitHub: SpeedTracker.
Specifically, look at the WearableMainActivity.java class. If you have properly connected to the GoogleApiClient AND you have the proper run time permissions for location, this code should work (from SpeedTracker):
LocationRequest locationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(UPDATE_INTERVAL_MS)
.setFastestInterval(FASTEST_INTERVAL_MS);
LocationServices.FusedLocationApi
.requestLocationUpdates(mGoogleApiClient, locationRequest, this)
.setResultCallback(new ResultCallback<Status>() {
#Override
public void onResult(Status status) {
if (status.getStatus().isSuccess()) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Successfully requested location updates");
}
} else {
Log.e(TAG,
"Failed in requesting location updates, "
+ "status code: "
+ status.getStatusCode() + ", message: " + status
.getStatusMessage());
}
}
});

Are you sure the watch is getting GPS signal? Use an app to test it, or some watches you can test gps in the Dev options, like the sw3.

Related

Notification app for beacon

I am looking for a simple app (preferably for iPhone, but if not then for Android), which pops up a message when it receives a signal from a beacon.
The beacon is a Sensoro 4AA, we only purchased it for demonstration purposes.
The idea is: once we turn the smartphone's bluetooth on, the beacon is detected and the message just pops up.
Is there such an app (as simple as can be), where I can just insert the beacon's details (uuid, addtess, or whatever is needed) and maybe some text or link, in order to achieve that?
Thanks
You can use Beacon Simulator for Creating, broadcasting and Scanning Beacons as per your needs and testing.
For Android: https://play.google.com/store/apps/details?id=net.alea.beaconsimulator
For iOS: https://itunes.apple.com/us/app/noteacons-beacon-simulator/id1136196655?mt=8 or https://itunes.apple.com/us/app/dropbeacon-a-beacon-simulator-for-development-purposes/id866760594?mt=8
I hope this helps!!!

Beacons integration without application on device

Can i know is it possible to communicate with Beacon without having any Mobile app on device?
Thanks in advance
Both Android and iOS devices need some kind of app installed to interact with your beacons. Some phones have such apps pre-installed, but the options are limited. The two such apps with the widest distribution are:
Google Chrome App (Android/iOS)
Google's Chrome app will interact with beacons supporting Eddystone-URL (also known as physical web), which transmit a URL that can be displayed within Chrome when the app detects it.
This works on both Android and iOS devices with Chrome installed. For newer Android phones, this is a relatively high percentage of devices. For iOS, it is a very small percentage, as the app is not installed by default. This makes it of very limited use on iOS.
The other real drawback to relying on Chrome for beacon detection is the hoops users have to jump through to opt-in, and the way the beacon notifications are buried. Until users opt-in, they will see no notifications on beacon detections. Once they do, they will see a very generic notification "Physical web beacons are nearby", and only once the user taps on that are the specifics about the web page associated with the beacon transmitted URL displayed.
Passbook (iOS)
Apple's passbook app will bring up a passbook entry (usually used for tickets, coupons, etc.) associated with a set of iBeacon identifiers if the user comes within range of the beacon. In order to use this, however, the user must first download the passbook entry to his or her iPhone. Only once this is downloaded and opened will the app respond to associated beacons.
EDIT April 2020: For a time prior to December 2018 Google supported app-less notifications based on beacon detection using their Google Nearby product. This was discontinued in December 2018 due to predictable abuse and spam that it generated. While you may find some outdated documentation online about this ability, understand that this feature no longer works. As of this writing, my understanding is that this answer is still correct.
You should checkout Eddystones from Google. They can push you URLs even without app.
If you want to interact with beacons and do custom stuff (notifications, http requests, etc) you will need an app.

Is there a Sony SmartWatch 3 emulator/AVD/skin with GPS?

This code return false in Wear API 22:
PackageManager pm = getPackageManager();
boolean hasGps = pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
Per default in Android Studio AVD Manager for Wear AVD there is no GPS option. However if I "Clone Device..." (guess same as "New Hardware Profile") an existing one and then edit it, there is an GPS option. Still the AVD does not return true (code above).
There is an option "Import Hardware Profiles".
Does Sony have a "Hardware Profile" which I can import?
How can I test my local Wear GPS (without buying Sony SmartWatch 3 hardware)?
Is there a Sony Smartwatch 3 emulator/AVD/skin?
Not all Android Wear devices provide a GPS unit. Instead, you should use the FusedLocationProviderApi from Google Play Services to request location updates. The nice part about this API is that if your phone and watch are together, it will use the GPS in the phone to save battery - it will only use the GPS on the wearable when it is disconnected from the phone. The FusedLocationProviderApi uses the same API as available on phones, so you can reuse most of your existing code.
Here is a blog post I wrote about this:
http://android-developers.blogspot.com/2014/10/gps-on-android-wear-devices.html
Documentation for FusedLocationProviderApi:
https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi
And a sample that implements this:
https://github.com/googlesamples/android-SpeedTracker
There is no emulator that provides the GPS functionality of the Sony SmartWatch 3.

Is it possible to get an app to open up when entering a beacon region / within range of a beacon/ibeacon

I'm exploring the end user experience for a beacon prototype but I'm struggling to find any end-user scenarios that involve the app becoming active / opening up on the screen when within range.
I can get the app to send a notification and this is the most likely experience on both Android and iOS but does anyone know if it is possible to get the app to open up?
It's unlikely that I'd want real customers to have their experience interfered with in this way, I think it's ok if the app is already running and is open but not if it's running but not open.
Thanks
On Android this is possible. The reference app for the Android Beacon Library demonstrates how to do exactly this.
On iOS, it is not possible due to OS security restrictions. See here for details. The best you can do is send a local notification to the user when the beacon is detected, then if the user gestures to it, bring up the app.

admob ad doesn't make requests (or there are no ads to show)

I just downloaded the Beta sdk for admob on WP7 and after including the banner in the app(and viewing the default banner in the emulator mode) i've added the admob on-site publisher id an tried to run the app on a real device but there was no add showed (in debug and in release mode). The space is reserved (~75px of black space).
When looking in the console i see "Error - Ad Not Available (NoFill)" and on the admob site i see that there wasn't no ad request ever made. I got to the following conclusions:
1) there are no ads for my app due to windows phone's still-limited presence (but why isn't my app showing ad requests on admob site?). Also i found this on google's site :
Windows Phone 7 is new to the AdMob market, so in the short term you
may see some low fill rates until advertisers add this platform to
their targeting. Using test mode during development should eliminate
inventory as a variable in your SDK integration testing.
2)i've just created my admob ad so maybe google has a certain approval process.
Any other ideas of this problem? Has anyone else experinced it, and if so, how did they get over it?
UPDATE my app is now active on the adMob site and can see requests (122) , a fill rate(3.28%), eCPM(0), RPM(0) but the ads are still not showing. What can be the issue?

Resources