Unregister android client from aerogear unified push server - android

I´m facing a problem on handling the register-unregister my activities/services or whatever I use from an aerogear installation.
If I register from a service onCreate() and unregister in onDestroy(), when I uninstall the application, the device keeps registered on server side... If I install the application again, it registers the device again and you can repeat this until you get tired. And, of course, sending a push to the alias given by the user, the messages will arrive once per registration.
Also, each time the application registers to aerogear, the deviceToken is different, meaning that it´s got more to do with a generated hash for each installation than for a unique identifier for the pair (app, device).
So, now the question, how to handle the whole cycle? and I mean, the daily run and the issue about if the user decides to uninstall the app, it gets killed and could not unregister and one month later decides he liked it so much that ends up reinstalling the thing again.
thx.
update
The problem grows as I go testing my application. If I log with two different users in the same device, then I get both user messages and I've got to twist a little bit more the client implementation.
update with aerogear database data
here´s the installation log for two devices with three reinstalls:
id alias deviceToken deviceType enabled operatingSystem osVersion platform variantID
0dd99505-bba9-45e9-bfbf-38621bd41c3d 568b347a5df69915000pig#gmail.com APA91bG9XSPpwbFenw0UETFLRxr2XoFw-HlH5yZpPgoCIVZLnv0QSqCx5iKqqhJ-tWF5CRISbydv6ItWZKxklD8OPtfxvuq1ekQEI3XkbFajsmGIJ3yjUIC0MGw3v2ITVd6byVtZLsI9uTfiDXyeNrXTxprzVxr9ng ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
0ee3619f-0eb4-4139-b1fa-fe3403eb380c 1c24c6e05b58738f000edu#gmail.com APA91bFrNknt7d57dFR5DagE4Nf1bCVyB93Jl1xU5_qELwYn5JmjYUpXrLE10yC6beZdUgae0ZgtKXgLI4LI-E_ROAFEI4xi-ZPhuE8UZB6K05L_mIWSk7kt32D7S9G2clw3WG51zvcQmaeg8xsG_VW-rnwfKZQVcg ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
107d4dac-fbcf-4f82-9135-702b83d06f7f 568b347a5df69915000pig#gmail.com APA91bEaN4AMJPZgML931rO4AdrMudfTmGVmYPqqARVLX1RxIfyYB46fGxlSK0w7g3qnU2d_cVOBi907TFIMoxBaOe3bvKI8DqsacrXMmT-DjhFoFRS2z4QCec9u0aRPm-EB9UwhfMrE3RrctdxDdNCQ0douuppYVQ ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
161474b6-067d-4b54-a750-e21a9896814e 1c24c6e05b58738f000edu#gmail.com APA91bGFE6cxLcxPDoRmv-HEIpA2jQndccrCryuR3q5BN4PG3EyHxISFoMCIwaPPXX8BIinrJOvNCbwpIrVOKw_mSv5TcLZnSgonR1grpiRkJ0mmwbFCme2CrwoMpkLkVUP7ZjwnYsr0HR3MKzmJLakrnlN-eMKr-g ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
a5cddabe-1c00-4369-b4cc-f6c5da8f8740 568b347a5df69915000pig#gmail.com APA91bGmFT7NCpfb1q4WHFK2wmQCQdMtW9ulQLiZYwrt9oyU4mqv9gCBN959pCw_wKy2zHw-JBU0p5SCzdpKN5l8i7uqPWk24ORHKE1Vf6rRUINkIRJheKVT6V6Wk38WQ7Rw1AgrqYXZN7WUImVSgd5cqq_p8lLISg ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
f7514716-68d9-4d00-837a-f1f9da503151 1c24c6e05b58738f000edu#gmail.com APA91bHTFJE7-nz_KB4aa2RUcEnFTVB0IzQZ-ZffPTujLWgi60xTMUeAet6YoUZJnXKnhBOSdAPgoaLDW18PWnwKXtc2MXxKjMYQQENNDdOxKQIV4fnMrAFWfwD_VT6x5XOJUWdQovGUwXiMX9SshCDvZJ4QnM1x_w ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc

I think the first problem was a UnifiedPush server bug, but it's already fixed.
About your update when you register a device on UPS the UPS don't know about your users, so you will need to send some information with your message and control it on your client.

Related

Smsgateway.me API - REST Mod disabled on V4

I've updated everything for their new API v4 and also the new Android application (the old one was removed from the Play Store).
Now I'm having a problem with the messages in application running android 5.0, I've to press "Check Server Now" everytime to check for new messages (which are sent to API correctly but gets the status Pending until I press in the app manually).
Someone tolds us to install the previous version of the .apk to solve this issue but I don't know how to get it.
Yes that is correct since May 12 I did need to update my php version it took a while but when I finally get it my phone did not need to download the app again now I see that play on my favor, I did use the app with no problems, I also saw that the sending process was not even aligned with the every minute I configure on my old samsung.
Today sadly 9/2/2018 my cell stop to work better said the app claimed for internet to be able to connect, of course I had WiFi and 4G but looks like something happened a 6 am pacific time.
I was expecting it was a problem with server so I wait patiently until 2 PM, and I asked my son to see the app on his phone Samsung J7 and the app was asking for user and password
I knew that the J7 was not able to configure the asking time to server looking for pending sms's but I thought will be enough for today sending messages every 5 minutes thinking was the default time. But did not work unless we click the manual form in the app or at least having the app on the screen swivel and will update sending sms's as mentioned leaving the status on pending and some times sent.
I did something stupid delete my old version of the app from my old samsung and guess what, I could not download the new version for incompatibility with my phone, I still not sure if my old version will start to work later on the day or tomorrow, but certainly I lost the opportunity to know.
I used https://apkpure.com/es/sms-gateway-api/networked.solutions.sms.gateway.api go get the older version an installed again on my SGH-M919V Samsung Android 4.4.2 not compatible anymore so the option of configure the refresh is not there any more, J7 was not able to do that,
Sep 3 2018 team upload new version since the notification process to send the sms did not work, the new version suppose to ask server every 2 min not working on my J7 Samsung. so at this point I have to send the messages clicking manually to search on the server for sms pending to send.

How to make own OTA app in AOSP - fslota?

we have build Android from sources and it looks good on our device. Currently we need to make own OTA process, but we dont know how.
We try to implement FSLOTa (https://github.com/embest-tech/android_packages_apps_fsl_imx_demo/tree/master/FSLOta) against our http server, but documentation is very poor - so we simply add source to our source and compile it.
Problem is, that we see app in our box, but it doesnt nothing.
Or there is way to modify built in OTA app, when we change server to our server, we get http request at least. But we dont know, how tells http server to box about new version - any manifest file? XML, JSON or? Is there any example?
Or is there another simple way for implements OTA update to AOSP?
Thank you very much
D
I dont know about FSLOTa nor do I know about the device you are working on. But If you want to implement your own OTA process you could try the following (Just a short draft since your question is very broad):
Create a system app that checks from time to time your server for new packages.
if it detects a new package it downloads it to your device.
it copies the downloaded update.zip to /cache/
Then the app creates the following file /cache/recovery/command and writes --update_package=path_to_your_file in it. (For more commands see /bootable/recovery.cpp)
Then it forces a reboot into recovery
recovery installs your ota package.
Update:
I quickly checked the app you linked. I would check these things:
Do you get till the point where RecoverySystem.installPackage() is called ? (https://github.com/embest-tech/android_packages_apps_fsl_imx_demo/blob/master/FSLOta/src/com/fsl/android/ota/OTAServerManager.java#L282)
Do you see a message in logcat from the RecoverySystem that it is going to reboot? (maybe you have a permission problem and your app is not allowed to force "reboot recovery")
Is the path to your update.zip correct? (it should be in /cache/)
i have been developing an OTA updater android application, you should know application send request to backend server and receive a JSON file about the available update. everything iiiiiiiiiiiiiiiiiiiiii anwserd was ok on non/AB devices, but for A/B devices, the android application downloads the OTA package under /data
and installation will not happen in recovery or anything, the changes will apply to the unused slot before REBOOT.

Android Wear: getDataItems returns 0 items

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.

How to detect if the Wear app of my Android app is already installed in the watch

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).

Voice recognition not working as a service when Google Search version > 2.2.10.573038

Some friends and I have been working in an app that requires to have a service running listening for voice commands. We have successfully implemented the listener. However, after we started having problems because the operating system killed the service after a while (I suppose to reclaim some resources). We (apparently) fixed this problem by making the service a foreground process (calling startForeground).
We have been testing the app in a range of devices and we found out that the app was still being killed by the OS in some devices. Having a close look at this issue we found out that the devices where the app is being killed have Google Search version greater or equal to 2.3... (for instance 2.4.10.626027) If we uninstall the updates and downgrade to version 2.2.10.573038 then it works like a charm.
By the way, I have mentioned Google Search here because when we start the voice listener, a package named com.google.android.googlequicksearchbox is started.
Does anyone have an idea of why this might be? or what main differences exist between the versions 2.2.10.573038 (and older) and those after? Of course the solution would be to downgrade the version but we would like it to be compatible with the newer versions too...

Categories

Resources