Getting total unread notification count in Tizen and opening notification app on Gear 2 - notifications

I am trying to add a notifications feature to my watchface.
I want to get total count of notifications on the Samsung Gear 2 and then when a specific areais clicked I would like to take the user to the "Notifications" app of the Samsung Gear.
Is this possible ?
How ?
Thanks.

At the moment Notification Web API is not available in wearable SDK. So you can't.

To launch application you have to know ID. There is example in documentation:
tizen.application.launch(ApplicationId id, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
or:
tizen.application.launchAppControl(
appControl,
appId,
function() {console.log("launch application control succeed"); },
function(e) {console.log("launch application control failed. reason: " + e.message); },
appControlReplyCallback );
You can find information in Tizen SDK help:
API References > Device API Reference > Application
and
Programming Guide > Device API Guides > Application Guides
You need the permission: http://tizen.org/privilege/application.launch

I want to launch "com.samsung.wnotification2". How ?
anybody who could help me to launch this ?
I hope you've found an answer already, though let me post an answer as I am stumbling into your question for fifth time ;)
var notificationsAppId = "com.samsung.wnotification2";
tizen.application.launch(notificationsAppId, function() {
console.log("launch success");
}, function() {
console.log("launch failed");
});
Please also take into account that this method of calling notifications screen will not work for Gear S - Samsung disabled ability to launch the "com.samsung.wnotification2" (though, if you try, the launch request will not indicate failure!)

Related

How to publish LocalScreenShare tracks from IOS to Web browser in React-Native using Twilio

I want to integrate Screen Share feature in my react-native application in which I am using Twilio for video communication. In Web we are able to achieve this by following these steps.
1 : We get the media device stream using
navigator.mediaDevices.getDisplayMedia({
video: true,
});
2 : Then we get the first stream tracks using
const newScreenTrack = first(stream.getVideoTracks());
3 : After that we set this newScreenTrack in some useState
const localScreenTrack = new TwilioVideo.LocalVideoTrack(
newScreenTrack
);
4 : After that we first unpublish the previous tracks and publish the new tracks using
videoRoom.localParticipant.publishTrack(newScreenTrack, {
name: "screen_share",
});
5 : And finally we pass these tracks in our ScreenShare component and render these tracks to View the screenShare from remote Participant.
I need to do the same thing in my react-native application as well. Where if localParticipant ask for screenShare permission to another participant. Participant will accept the permission and able to publish the localScreenShare tracks.
If anyone know this please help me in this. It would be really helpful. Thank you
I think this is an issue with the react-native-twilio-video-webrtc package. It seems that, as you discovered in this issue, that screen sharing was previously a feature of the library and it was removed as part of a refactor.
Sadly, the library does more work than the underlying Twilio libraries to look after the video and audio tracks. The Twilio library is built to be able to publish more than one track at a time, however this React Native library allows you to publish a single audio track and a single video track using the camera at a time.
In order to add screen sharing, you can either support pull requests like this one or refactor the library to separate getting access to the camera from publishing a video track, so that you can publish multiple video tracks at a time, including screen tracks.

Cannot register device with TalkJs for push notifications

I am working on a React Native app that uses TalkJS. We want users to get a push notification for every message they receive. The messages are going through but we aren't getting notifications. We have uploaded our .p12 to the TalkJS dashboard and followed the docs for setting up a React Native project. Below is the relevant code we're injecting to the TalkUI loadScript. We followed https://talkjs.com/docs/Features/Notifications/Mobile_Push_Notifications.html
const res = await window.talkSession.registerDevice({ platform: "ios", pushRegistrationId: "${deviceToken}"});
alert("registering deviceToken ${deviceToken} response: " + res)
We are getting the alert with the correct deviceToken but this method does not return anything. We tried .then and an error first callback but nothing is coming back from this method.
Edit: this method is not designed to return anything, so the response is expected to be empty.
The Promise was designed to not return anything as Kapobajza mentioned.
From their support chat: "We have an issue regarding push notifications on iOS when using React Native."
Edit: this issue has been resolved. In addition to work that needed to be done by the TalkJS team, push notifications require a user to have a 'role', as is very loosely implied in the Overview for Push Notifications

Open Facebook Messenger using Titanium on Android

I want to open the Facebook messenger on Android.
To do this on iOS, you simply need to do the following (as described here: https://github.com/appcelerator-modules/ti.facebook):
var fb = require('facebook');
fb.presentMessengerDialog({
title: "Appcelerator Titanium rocks!", // The title of the link
description: "Shared from my Titanium application", // The description of the link
link: "https://appcelerator.com", // The link you want to share
referal: "ti_app", // The referal to be added as a suffix to your link
placeID: "my_id", // The ID for a place to tag with this content
to: [] // List of IDs for taggable people to tag with this content
});
How would you do this on Android?
Actually, there's no such method for Android yet using native Ti.Facebook module. You can see at this link Ti.Facebook that it's only for iOS & starting from Ti SDK 5.4.0
In David's answer, he missed the very first line of that code file which says this:
if (Ti.Platform.osname == "android") {
Ti.API.warn("This feature is currently iOS-only.");
return;
}
But you can still try to open the messenger dialog on Android using Intents as described here Android Intents in Titanium
You can search Google for similar questions & I hope you can find plenty of them. Here's one such example FB Messenger Intent

Tizen Web : How to get a call back regarding which application is launched

I am developing an App Lock app. Here whenever an application is launched by user
i want a callback in my app regarding which app is launched. Based on some predefined settings i want to show lock screen.
I don't know which API i should use. Whats the in "TI ZEN" using which i can
monitor the app launch.Basically i need to know which application is in foreground.
Using the existing API i have a list of applications installed but need to monitor them.
function onError(err) {
console.log('Error occurred : ' + err.message);
}
function onsuccess(applications) {
var appInfo;
for (var i = 0; i < applications.length; i++) {
appInfo = applications[i];
console.log('Application ID: ' + appInfo.id);
console.log('Icon Path: ' + appInfo.iconPath);
console.log('Name: ' + appInfo.name);
console.log('Version: ' + appInfo.version);
console.log('Show: ' + appInfo.show);
}
}
tizen.application.getAppsInfo(onsuccess, onError);
My Answer is a bit late, but in case you still need it -
Native API
I cant tell what version of Tizen you are using, but for Tizen 3.0, you can get callbacks for whenever an app in launched using the Application Manager API (native API).
Specifically, the function app_manager_set_app_context_event_cb will give you callbacks for when an app is launched or terminated.
Web API
Currently the Javascript API does not have the corresponding function.
Ideally, you need to create a hybrid application and call the above mentioned native API - its not too difficult.
If, however, you want to stick to JavaScript, you can keep calling the function tizen.application.getAppsContext() to monitor which apps are currently running. You won't get a callback when an app launches, but you can poll the above method once every half second to check the currently running apps and kill the appp if you want it locked.
Note that polling too often might affect device performance.
You have to use Tizen Background Service application as your app have to always check which app is coming to foreground.
And for detecting app launching, you may use Tizen App Control API.

equivalent to android's share intent concept for iPhone using titanium?

I want to add share content functionality in my iOS app. I am developing an app in titanium for iPhone. I want to add a share button that when a user clicks will open a dialog box contains many different option like Facebook, twitter, email , and print.
Unless this has been included in the Appcelerator Framework, you are going to have to write a module
"Share Screen" iOS 6
There is a module for this that wraps the Social.framework on iOS. Ive used it in my own apps and its quite nice. Find it here.
And a small example of how to make it work.
var Social = require('com.0x82.social');
Social.showActivityItems({
activityItems : ["http://stackoverflow.com"]
});
Social.addEventListener('activityWindowClosed', function(e) {
if (e.completed) {
alert('Shared successfully');
}
});