pushwoosh setTags "Device not found" error - pushwoosh

setTags method always
returns a 201 error code, the device is not found. even though I use
the same device id in the createMessage method and it works fine. Are
those different? I mean aren't "devices" and "hwid" both refer to the
same thing ? devices are a list of hwids, right?

from PushWoosh Support
Hello, Thank you for contacting us! deviceId and hwid are two
different things. If you check the registerDevice method, there is a
"push_token" or "deviceID", which is being sent by APNS/GCM. It is
unique for each app on each device, even though with iOS sometimes it
is similar for several different apps on one device. hwid is the
hardware ID that we set with our SDK. It is being sent in setTag
method. Please note that you do not have to add anything manually.
The setTag method is a method that our SDK calls, so it takes the same
hwid which is used in registerDevice. Please let me know if I may be
of any further help! Kind regards, Nastya Lagunova Pushwoosh Team

Related

Requesting runtime permissions in Kotlin

I have a MVVM app, which needs Bluetooth through the entire app. The only screen that doesn't require Bluetooth is the Onboarding screen. In the first screen, the app starts automatically searching for devices, which requires BLUETOOTH_SCAN to function properly. I have attempted numerous things to request the runtime permissions and check if the Bluetooth is on, but nothing seemed to work. I'd greatly appreciate any help.
I have tried calling the functions in the onResume() of the activity, but it slows down the app a significant lot. I have also tried requesting the permissions when the startScan() function gets called, but that seems to crash, because in order to start the scan I need to have the permissions allowed and the bluetooth adapter should be initialized, a.k.a Bluetooth should be turned on
Did you had a look at this Answer?
https://stackoverflow.com/a/69972855/20356055
It describes very good how to request the bluetooth permissions.
And don't forget to add the permissions in the manifest ;)

Can someone clarify IOS Safari Service Worker Support

Looking at the MDN documentation IOS/Safari fully supports ServiceWorkerGlobalScope.onfetch but when you look at the FetchEvent specification it says it is not supported at all by Safari.
In particular, I would like to store some state for each client and was hoping to use the fetchEvent.clientId property of the event to index it. Of course I presume I also have access to the fetchEvent.request object otherwise I can't see how a service worker can do anything useful and I could simulate clientID from a passed in parameter in the url. But the docs don't really tell me what IOS/Safari supports and doesn't so I don't know which way to go.
Can someone please tell me precisely what does IOS/Safari pass when it calls the defined onfetch function.
I found the answer to my question by using https://jakearchibald.github.io/isserviceworkerready/demos/fetchevent/
connecting my iPad to my Macbook and debugging my iPad. I was eventually able to open the web inspector for the Service worker for that page, and the console.log showed the event passed in.
FetchEvent.clientID is present but a zero length string. As it happens I did the same thing on my (linux) Desktop using Chrome and its also a zero length string, BUT it has another parameter resultingClientId with what looks like a UUID in it. That parameter is not there in Safari.
The FetchEvent.request is there, and in particular the URL. So I can generate my own client id in the client (I am using Date.now().toString() as that is good enough for my purposes) for use in the service worker. In fact my site without a service worker was using the in the URLs I need to intercept already, so I am happy that I have a solution.

DeviceClient.GetTwinAsync() returns null?

I've created an IotHub, added a device, created a UWP app which uses the DeviceClient to successfully connect to the hub.
I can send telemetry as expected, and see the results in the Device Explorer.
However, when I try to fetch the device twin, I'm returned a null.
var deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Amqp);
var twin = await deviceClient.GetTwinAsync(); // <<<< returns null
Are there any common scenarios that might cause this? Such as creating the IoTHub & device before Twin's were released. Or, not having set any desired properties before hand? Or, using the wrong shared access key? (etc.)
-John
SOLUTION: Twin capabilities requires the MQTT protocol, I was using AMQP.
I'm sure there is a mention of this buried somewhere, but after spinning on this for hours I can safely say it wasn't obvious.
On a more practical note: it would probably be helpful to throw an exception in the GetTwinAsync() method, if it is called on a connection that is not capable of supporting Twin.
Hopefully this post will help the next person.
-John

NSNetServiceBrowser did NOT find published service

On an iPhone (the server), I've tried to publish a service and my code ran into the NSNetService object's delegate method:
-(void)netServiceDidPublish:(NSNetService *)sender
So I believe that my service #"_chatty._tcp." has published successfully. Then on another iPhone (the client), I use NSNetServiceBrowser to find my service, but it did NOT run into the delegate method:
-(void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing
I found some questions related to my case on this site, most of the answer remind to check the delegate object whether is out of scope or not. I'm sure my delegate work well because it ran into another delegate method like:
-(void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)aNetServiceBrowser
Can anybody help me find out the reason?
Here are some parts of my code:
I init the service like that:
#define MY_PROTOCOL #"_chatty._tcp."
self.myService = [[NSNetService alloc]
initWithDomain:#"" type:MY_PROTOCOL
name:#"thaith" port:self.port];
The port is initialized with a given listeningSocket in the Browser class:
NSNetServiceBrowser* finder = [[NSNetServiceBrowser alloc] init];
//I also retain the finder.
finder.delegate = self;
[finder searchForServicesOfType:MY_PROTOCOL inDomain:#""];
After having come across the same problem and giving up for a month. I've just come back to it and solved it:
Even though the sample code in the docs seems to imply otherwise, don't use a local variable for the NSNetServiceBrowser. As soon as it goes out of scope it gets garbage collected. Make finder an instance variable or property so its sticks around. I didn't spot this straight away as the netServiceBrowserWillSearch: delegate was getting called so I assumed everything was ok...
Possible Solutions
Check both WiFi identifiers are same
Check both are in same WiFi network
Check the NSNetServiceBrowser delegate assigned as same class
At last download sample Apple.Developer Witap Application , install in two devices , test and confirm it working.
Instead of downloading bonjour browser, I suggest using the terminal command:
dns-sd -B _chatty._tcp local.
For me, it shows that the server side is working fine.
Currently, I can find the service when my application starts, my only issue is that once I stop the server, I get the "removed" event but running it again, I cant discover it anymore. I know the problem is on my client side, thanks to dns-sd - B
I would narrow the scope and try to find the problem place. First, find out whether the service is published correctly. Use Bonjour Browser application (you can find it in the Internet) on a computer within the same local network where you publish the service. I hope you publish and browse in the same local net. If the Bonjour Browser can see your service then you know it is published correctly. Then work on the browser side to connect to it.

Adobe Air crash on NetConnection call

I have an Adobe Air mobile application that has a NetConnection. One on call to my AMF server it makes the call and everything returns fine. When I make a second call my app crashes.
Anyone one run into this?
you're going to need to get more info. Run it in debug mode and you should get a stack trace, variable values and the like.
Figured it out. My models in the client and on the server didn't match. Why AIR just crash and didn't give me an error is weird.
Maybe your server client is the cause of the error!
It may be the reason of automatic combine of the two amf calls by NetConnection.
So, your function on server side will be run twice.
Check your require or require_one on server side.