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

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.

Related

How to use Firebase Push Notification Services without adding GoogleService-Info.plist file in Custom Created Framework Xcode

I have created a custom iOS Framework and I want to use Firebase Cloud Messaging from Push Notifications such that If anyone integrates the Framework in his App then he must be able to receive Push Notifications with minimal configuration.
Also, can I add Push Notifications required code programmatically to avoid using GoogleService-Info.plist?
How can I achieve the above functionality?
I am trying to do something similar. The main issue here is giving your framework a bundle id and ensuring that it is kept when imported in the app. I have been suffering with firebase complaining about inconsistent bundle ids.
In order to initialise a firebase app programatically you can use the snippet below:
let manualOptions = FirebaseOptions.init(googleAppID: "", gcmSenderID: "")
manualOptions.bundleID = ""
manualOptions.apiKey = ""
manualOptions.projectID = ""
manualOptions.clientID = ""
FirebaseApp.configure(name: "gameballSDK_FirebaseApp", options: manualOptions)
All the data can be obtained from your firebase project GoogleService-Info.plist
This code initializes a secondary firebase app. I am not sure if someone has been able to receive push notifications using firebase secondary app. To initialize firebase primary app use the function below:
FirebaseApp.configure(options: <#T##FirebaseOptions#>)
This won't work if the app using your framework is already using firebase for push notifications

inconvenience with video call. Agora.io. the best solution?

how should the client be notified that the master is offline. And how to integrate the video call UI similar to Whatsapp. Can anyone suggest the best solution?
that will be a part of your app logic. there are a few ways to implement this but one way to do it is to see if the particular user is running the app on foreground and log that as a flag in your database.
For example here it is using Firebase:
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
// user is offline
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(false) // NO
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(true) // YES
}
For the video call UI you can actually easily customize that using one of included UI in the Agora.io demo apps

Confused with IOS Deep linking

I'll just want to ask if someone here know the step by step process of creating a deep link for an IOS app? I've tried to read some articles but it did not give me absolute answers. Thank you :)
Deep linking is basically just setting up url to your app so that other apps can launch it with information. The can launch to certain parts of the app if you set it up so that your app reacts to certain urls. So there are a few things that you have to do. For this example I will use two apps. If you are trying to integrate with an existing app you just have to find out what their url schemes are. So for this example I will use 'Messages' as one app and 'Schedule' as another.
First: in the 'Messages' app we will need to setup the schemes our Schedule app to call.
So open up your first app we need to add schemes so other apps can open it. Go to your info.plist click the little + and type URL types hit the triangle to expand and hit the + type URL Schemes and within that one add an item and put your apps name in it. Also add URL identifier along with $(PRODUCT_BUNDLE_IDENTIFIER) as the value. `
Then we just have to add the apps that we can open so hit the top level + again and add LSApplicationQueriesSchemes This whitlists the apps so we can evaluate weather or not they are installed on the device.
Now we can jump over to the other app and create a way to call this. For this example lets make it happen when we press a button.
IBAction launchMessagesApp() {
let url = NSURL(string: "Messages://") where UIApplication.sharedApplication().canOpenURL(url) {
self.launchAppWithURL(url, name: "Messages")
}
The canOpenURL(url) checks to see if the application is on the device. If you wanted to you could launch the app store to your app if that retuned false. then launchAppWithURL actually launches it. That is the basic setup you may also want to have multiple things happen so you may have multiple url schemes that launch the same app but take it to different parts of the app. In the app delegate of the app in the function
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
print(url)
//Any customizations for the app here
}
You can do anything you can imagine.
Have you checked out Turnpike? It's an open source tool for enabling deep linking in iOS apps. http://urxtech.github.io/#GettingStarted
If you want to create a deeplink you might need to do some server code to detect the user device/browser and do some actions based on this.
I've created a tool that simplify this process, you can check it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.

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

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

WP8: Can this (PhoneApplicationService.RunningInBackground ) be used outside of location based app?

From this link below, it seems that your app can still get event when app is switched to background. But it seems it is used only for location based app. Can normal app do that? I had tried to declare ID_CAP_LOCATION but still Application_RunningInBackground not get called when switch to background.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.shell.phoneapplicationservice.runninginbackground(v=vs.105).aspx
The app doesn't execute in background, unless it is continously tracking the location.
This section lists the conditions under which the operating system
will deactivate an app running in the background....
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and
StatusChanged events of the Geolocator class or by calling the Stop()
method of the GeoCoordinateWatcher class.
Source: Running location-tracking apps in the background for Windows Phone 8
You will find complete info of how to run apps in background here:
How to run location-tracking apps in the background for Windows Phone 8