ALL,
I'm trying to develop an Android application. The application will use the GeoLocation which is based on the Google Play Services.
I also have a phone for testing (Samsung with Android 4.2.2). When checking things with Eclipse I see that the device has this service but its version is not the same as the application was developed with.
So I push the code which should go to Google Store and update the service to bring the proper version on the device. Now this device does not have a service only a WiFi (meaning its just a piece of hardware, not the phone).
Now when I ran this code it goes to the Google Store and it continuously tries to find the appropriate .apk.
The code I pushed is as follows:
int res = GooglePlayServicesUtil.isGooglePlayServicesAvailable( getApplicationContext() );
if( res != ConnectionResult.SUCCESS )
{
try
{
GooglePlayServicesUtil.getErrorDialog( res, this, RQS_GooglePlayServices ).show();
}
catch( Exception e )
{
Utils.displayErrorDialog( this, e.getMessage() );
}
}
What am I missing? It should just be straight update.
Thank you.
My problem sounds related. I have installed Foursquare on my Android (Jelly Bean) and when I launch Foursquare it pops-up with, you must upgrade Google Play (sounds like what you are trying to do in your App). I then click on the button and it launches the GP Store to upgrade. The upgrade stops progressing at 54% completion. Consistently -- after multiple times. I am suspect of memory size, as my Android is SLOOOOOWWWW, under powered and low on memory.
Related
On my AndroidTV Emulator I have:
val am = this.getSystemService(ACTIVITY_SERVICE) as ActivityManager
am.runningAppProcesses?.forEach {
Logger.debug("XXX", "Running ${it.uid} , ${it.processName}, ${it.pid}")
}
I also start other 3rd party apps, but I dont kill them.
The Google Docs say:
Returns a list of application processes that are running on the
device.
for ActivityManager.runningAppProcesses.
When executing this code from Android Studio, runningAppProcesses list has always size 1 and its the current app triggered from Android Studio?
I was expecting, that these 3rd party apps, I launched earlier are listed there as well?
What is meant by "application processes that are running on the device"? Are backgroundprocesses not included there?
How can I do so?
I would like to create a service (let's call it Service A) that runs on Android and is used by 3rd party applications (let's call one of these applications Application B). Such a solution would be similar to Google Play Services for AR.
I'm trying to understand how to create the dependency between Application B, and Service A on the store, such that when installing Application B, Service A is also installed.
To return to the Google Play Services for AR example, as a 3rd party app developer, I just have to specify a dependency to the ARCore library, and when I install the app on a device, the service is also installed.
The reason I want to do this is to be able to update Service A independently of updates to Application B, as the release cycle of Application B is not under my control.
In order to create the dependency between Application B, and Service A You can definitely utilize the uses-library Manifest tag to prevent people from downloading it from the store without your custom dependency being on their device, but this will only prevent them from obtaining it from the store; they could still download it a myriad of other ways.
Your best bet would be to have your application launch to a specific launch activity that checks if the package exists on their device:
public static boolean doesUseHaveMyDependency(Context context){
try{
context.getPackageManager().getApplicationInfo("com.yourlib.package", 0 );
return true;
} catch( PackageManager.NameNotFoundException e ){
return false;
}
}
With that, you can determine if your custom library is installed. If not, simply redirect them to the download link to obtain it, then when they reopen the app you check again. Once you have confirmed that they have it, you can progress to the main application.
So I have an app that works flawlessly on many devices. The problem is on one specific phone with Android 6.
The location for our app only works when another app uses the GPS.
For example, starting our app, the GPS icon starts as if the GPS was active but location updates on the app do not appear or refresh. Then, we start Google Maps and only then locations on our app start getting refreshed. As soon as we close Google Maps, our locations stop being received.
I actually tested the app on another phone with Android 6 with no problems.
I think there might be some kind of issue with Google Play Services or with the new the permissions schema. Or maybe with BroadcastReceiver receiving the position updates.
Key information:
Our app es compiled for SDK 22 with Google API.
Google Play Services version on the phone with the issue is 8.4.92
The app uses this version of play services:
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-location:7.+'
compile 'com.google.android.gms:play-services-maps:7.+'
compile 'com.google.android.gms:play-services-gcm:7.+'
All permissions are activated for our app on that phone.
The phone with the problem was working fine before it got updated to Android 6.0
We tested on another device with Android 6.0 and had no issues.
The phone is in a client in another continent so we don't have access to debugging or logs. No errors occur though because we would receive those on Fabric.io.
We use a Broadcast to dispatch new positions to a service and an activity so the problem might be there.
Im running out of options and tests.
Any ideas?
Thanks,
EDIT
The problem is that on that version of Android, getSpeed from Location is always 0.0, unless another app is using the location, then we get updates with the speed included.
This really sounds like a bug. Why would legacy apps not get the speed in the location? Assuming its because we use API 22.
On a side note, we use speed to filter out positions and stop updating location when the phone is standing still. Thats why we did not see location updates.
I guess we will have to calculate our own speed.
Here is a big problem that i simply don't know whats going on...
I have an app that stores Data in data API. The mobile app is aroudn the play store for some time and I decided to make a app for wearable.
My problem is: when the user install the wearable app for the first time (via Google Play), it need to load the data from the DataApi. But it simple returns 0 itens!
DataItemBuffer dataItems = Wearable.DataApi.getDataItems(mGoogleApiClient).await();
Observations:
GoogleApiClient IS CONNECTED
The Wearable receives the onDataChanged from WearableListenerService and this part is working fine.
I've already tested with .setResultCallback but results still the same.
I have two copmuter for developments, one is one my work and another is on my home.
In my tests, I DELETE the emulator and create a new one, to simulate a "new device beeing connected for the first time".
DataAPI says that the data is synchronzed to all devices but is seems not be working like that. How to solves this? Any workaround? SOMEONE HELP =(
It seems i found the solution for this problem. As I mentioned i have two computers for development, so, 2 development keys.
My mobile app was installed using the "A" computer's key and the wearable was using the "B" one. So, to solve this problem, when start developing always remember to re-run the mobile and wearable app from the same computer to your devices.
Is it somehow possible to detect if the Wear mini app inside an Android app is already installed in the watch?
I have an app which cannot be used on the phone until the Wear part is installed in the watch, so I want to block all interaction until then.
What about app updates, is it possible to detect if the Wear part was already updated?
EDIT:
It looks like the Data API and even Message API calls are buffered and delivered after the app is installed. This however does not solve the issue with app updates. That is solvable with the accepted answer.
One Solution is to use CapabilityClient(https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityClient). First you can detect whether the Wearable and phone are connected or not using NodeClient(https://developers.google.com/android/reference/com/google/android/gms/wearable/NodeClient). Below I have mentioned the code to detect whether the watch is connected to phone or not in android.
Task<List<Node>> nodesTask = Wearable.getNodeClient(MainMobileActivity.this)
.getConnectedNodes();
nodesTask.addOnSuccessListener(new OnSuccessListener<List<Node>>() {
#Override
public void onSuccess(List<Node> nodes) {
nodeSize = nodes.size();
for (Node node : nodes) {
Wearable.getMessageClient(MainMobileActivity.this)
.sendMessage(node.getId(), MESSAGE_PATH, "Hello from AndroidWear".getBytes());
}
Log.d("Hello" , "Message sent to Cordova");
}
});
So, nodeSize tells how many nodes/watches are connected.
Wearable.getMessageClient(MainMobileActivity.this)
.sendMessage(node.getId(), MESSAGE_PATH, "Hello from AndroidWear".getBytes());
This piece of code helps to send the message from phone to watch. Now coming to detect whether the watch has the application or not. Below is the mentioned code for it.
Task<CapabilityInfo> capabilityTask = Wearable.getCapabilityClient(this)
.getCapability(CAPABILITY_WEAR_APP, CapabilityClient.FILTER_REACHABLE);
capabilityTask.addOnSuccessListener(new OnSuccessListener<CapabilityInfo>() {
#Override
public void onSuccess(CapabilityInfo capabilityInfo) {
mWearNodesWithApp = capabilityInfo.getNodes();
}
});
So, if mWearNodesWithApp comes as 0 it shows that app is not installed and if it shows 1 it means application is installed.
CAPABILITY_WEAR_APP should be of String type and should have the value which you mentioned in wear.xml of wear application and not of phone. Do remember to mention the same applicationId for both Phone and Wear application.
AFAIK, there is no out-of-the-box solution to do it.
If your Wear app does not have activities (and therefore no means to be started by user), what you can do is send something like IS_INSTALLED message to Wear periodically while handheld app is in foreground until Wear won't put it version number into data layer. On application update you can check for version number in data layer and if it's lower than current version - repeat the procedure.
This approach will as well solve problem with Wear device not being connected (or out-of-range which is essentially the same).