How to get app message from companion app if Pebble app is in background? - pebble-watch

"I am explaining whole scenarios here in order to avoid multiple discussion threads, as I am looking for quick help, so providing here all the details."
I have created a application which communicates with the android companion app, which has some of events scheduled and needs to send to pebble app, so that even if the timeline is muted for our app we can provide important information to pebble app user.
I am able to get the data from companion app and process it successfully only if the pebble app is open but my one more requirement is :
To get data in pebble app sent by companion app, even if my pebble app is in background.
ie. If the companion app sends me some message but the pebble app is in background so I should be able to read that message and wake up the Pebble app to show the desired information.
I am using "App Message" for communication between Companion app and Pebble app.
I gone through the Pebble Documentation which states :
"Background workers do not have access to the UI APIs, they also cannot use theAppMessage API or load resources. Most other APIs are available includingAccelerometerService, CompassService, DataLogging and Storage."
One more Query is :
As we can get notification in our Pebble if its came to Phone, so is there any way to open some desired app or related app to that message in Pebble watch.
Please guide me if there is anyway to get this done.
Thanks in advance.

Your Android application can launch the watchapp before sending the message to her. That should solve your problem.
As indicated in the documentation, the background worker on the watch cannot receive app messages.

Related

Azure Notification Hub losing the subscribe when app is reinstalled

I have a problem with Azure Notification Hub.
When my app is started in first time, the notifications working correctly, but when did a rebuild the app by Visual Studio, the notifications stop working and the Android Services with IntentFilters do not are called.
For the notifications works again, I need to uninstall the App in Android and run by Visual Studio again.
Have someone some idea about that problem?
My worry is: if I send the app to GooglePlay, the notifications would continue working after a update?
If someone know how to call the service to get the new InstallationId, always that the app to be started I will know how I can resolve the problem.
Can someone help me?
I did follow that tutorial:
https://www.youtube.com/watch?v=le2lDY22xwM&t=3312s
if I send the app to GooglePlay, the notifications would continue working after a update?
There is no need to worry about that, referring to this document, when you use Azure Notification Hub, it's using Android GCM to send the push notificcation. You could see my answer about Android using Firebase Cloud Messaging not receiving message.
As the Official document said :
On initial startup of your app, the FCM SDK generates a registration token for the client app instance. If you want to target single devices or create device groups, you'll need to access this token.
Explanation about Token :
An ID issued by the GCM connection servers to the client app that allows it to receive messages.
When you did a rebuild the app by Visual Studio your token is changed, but it didn't trigger the OnTokenRefresh method, so at this time the Token in your application is invalid. That's why your application cannot receiving message.
For more information, you could refer to Sending Push Notifications from Azure Mobile Apps and Implement the Firebase Instance ID Service.
When your app get a update, it will trigger the OnTokenRefresh method automatically, so your application can still receive the message.

How to work with background application?

I have created an app that triggers video at particular time similar to alarm, but the problem I am facing is that when I am out of application & have set the timings the video doesn't show up(i.e. similar to alarm I should get notification out side my app). Please help me out with the same. Would be very grateful for any helpful suggestion.
When an application is not running, you cannot predict what time its background process will execute, so there is no way that you can set an alarm with any degree of precision smaller than perhaps an hour. The only way to have timing close to accurate would be with a push notification from a server. Even then, the notification you receive will not be able to open and play video on its own. You could create a push/toast notification that originates at a server, sends the user a toast, the user taps it, and that opens the app to play the video. You can't do it without user intervention.
See this link for an overview, including the constraints on background agents: http://msdn.microsoft.com/en-us/library/hh202942(v=VS.92).aspx
You cannot open an app and play a video from a background agent. You can show a toast notification that would allow the user to open the app. You can use a Scheduled Agent or PeriodicTask.You can then use the ShellToast to show a toast notification so the user can open the app. Once the app is open you can start the video.

Unsuscribe to WP7 notification for uninstalled application

I have a toast notification system that is working on WP7. When I send a notification, all registered devices receive the toast notification.
But, If someone uninstall the application, I will continue to try to send to the registered device (in fact, I will ask Microsoft service to send to the unavailable device).
Is it possible to detect if someone uninstall the app, then I can remove it from my list of device to send.
Or maybe can Ms services tell me if the app as unsuscribe to the toast notification ?
My list of registered device grows infinitely ....
Thanks in advance for any Help,
Best regards
You can't detect if the user deleted the app, but can always check the subscription status return code when you send a notification!
Check here for the return codes, specifically where the SubscriptionStatus != Active

RSS-reader feed updates when app is suspended

So, Ive made Windows Phone app that contains rss-feeds. I would now like to add the possibility for toasts to popup when a stream is updated. Ive read up on how to use Toasts to notify the user, but how can i make my rss-reader periodically poll the rss-feeds for the latests news when the app is suspended in the background. Example code would be highly appriciated!
Check the "Background Agent Sample" Windows Phone Code Samples to see how you can create a periodic background agent, that will allow you to pool the rss feed(s) and show a toast notification to the user!

Use of Raw Notifications in WP7

I read the implementation of three types of notifications possible in WP7 app - Tile, Toast and Raw Notifications. I understand the use of Tile and Toast Notifications but I fail to understand how a Raw notification will be used in real world application. Can someone please help me understand.
If someone can help me understand the implementation wrt. an existing application like KIK messenger or WhatsApp Messenger, it will be great!
Regards,
Bhavik.
Raw notifications provides the ability for your application service to push data to the application while it is in the foreground without the need for your application to poll the appplication service.
For instance, meaning if you have the Messages application open, and you get a new Message, it'll show a notification (toast), without the Messages application having to poll for it.

Resources