I have developed wp8 app,
I am updating my app tile at some scenarios,
here the code i have used for update my tile
ShellTile TileToFind = ShellTile.ActiveTiles.First();
StandardTileData NewTileData = new StandardTileData
{
BackgroundImage = new Uri(#"/ApplicationTile.png", UriKind.RelativeOrAbsolute),
Count = NotificationCount,
BackTitle = offers.data.info[0].offer_title,
BackContent = offers.data.info[0].location_area,
};
TileToFind.Update(NewTileData);
Here my doubt is, is it possible to set navigation uri for the BackTile, like as i give the navigation uri in my toast message here
Microsoft.Phone.Shell.ShellToast toast = new Microsoft.Phone.Shell.ShellToast();
toast.Content = "#" + offers.data.info[0].location_area;
toast.Title = offers.data.info[0].offer_title;
toast.NavigationUri = new Uri("/LocationDealsPage.xaml", UriKind.Relative);
toast.Show();
I need to navigate to different pages while click the back tile and front tile.
Anybody please let me know, is that possible are not, if possible please let me know how.
If not possible is there any other way to do this.
Thank you.
Noorul.
There is no way to set a different URI to navigate to when the user taps a tile when the back is displayed.
If you need to navigate to different parts of the app you could use multiple tiles.
Alternatively, if you're remotely updating the back of the tile when there is new information available and you want to do a different action when launching the app and there is new information (e.g. go to straight to that new item rather than the main page) you could do this check when the app is opened. To avoid having to make a[n extra] network request on app start up, you could use a background agent to regularly pull down the latest data (including a flag to detect if there is a new item) so it's there when the app is launched.
Related
I'm developing a server-side application to upload files to Box. I'm using the Box .NET SDK, using JWT for authentication.
Here's how I set up my Box stuff:
var boxConfig = new BoxConfig(clientId, clientSecret, enterpriseId, jwtPrivateKey, jwtPrivateKeyPassword, jwtPublicKeyId);
var boxJwt = new BoxJWTAuth(boxConfig);
var userToken = boxJwt.UserToken(boxAppUserId);
var userClient = boxJwt.UserClient(userToken, boxAppUserId);
Then I use the UserClient object to upload a file to Box once a day.
My question is: Will that UserClient or UserToken ever expire? I want to know if I should get a new UserToken and instantiate a UserClient every time I need to use it, or if I could initialize all these things just once when my application starts up.
The token will expire after roughly one hour. The client is designed to fetch a new user/admin token as necessary so you shouldn't need to worry about it after the client is initially created. You might even try specifying a blank token when initializing the client and let the re-authentication logic handle things from the beginning:
var userClient = boxJwt.UserClient("", boxAppUserId);
I'm developing a class library for windows 10 universal apps (mobile and desktop device families only). I need to invoke an event if the user has been idle(no touch, mouse move, key press etc) for x number of seconds. This method can be used to solves this problem on android. But I couldn't find a solution on windows UWP.
Is there an API available in UWP to achieve this?
You can detect global input with various events on the app's CoreWindow:
Touch and mouse input with CoreWindow.PointerPressed, PointerMoved, and PointerReleased.
Keyboard input: KeyUp and KeyDown (the soft keys) and CharacterReceived (for characters generated via chords & text suggestions)
Use these to detect the user is active and idle out if it goes too long without any of these events.
I know this is really old question, but I think you can now get to same result with RegisterBackgroundTask
Just set:
new TimeTrigger(15, false) //For time trigger
Link
new SystemCondition(SystemConditionType.UserNotPresent)) //And so you want to know so user is not present
Link
Example usage in App.xaml.cs:
var builder = new BackgroundTaskBuilder();
builder.Name = "Is user Idle";
builder.SetTrigger(new TimeTrigger(2, false)); //two mins
builder.AddCondition(new SystemCondition(SystemConditionType.UserNotPresent));
// Do not set builder.TaskEntryPoint for in-process background tasks
// Here we register the task and work will start based on the time trigger.
BackgroundTaskRegistration task = builder.Register();
task.Completed += (sender, args) =>
{
//Handle user not present (Idle) here.
};
Alright I have my sqldb hosted online and can access it using phpmyadmin what i would like to do is create tables and add items to the tables via adobe flex builder 4.6 desktop AIR application.
Anyone know if i am able to do this, the idea for the program is so person at position A can enter a name and person at position B can then use his program to read those names
According to Accessing mysql from Adobe flex/AIR, AIR is unable to access MySQL servers directly, so you'll have to use web services or some custom API do to this. But yeah, sure it's possible to do what you want.
I agree with Isaac. However, I want to add that it is good coding practices to not allow client side applications modify a database directly. In the applications that I have built, I like to use PHP to set-up an API that then interacts with the database. The AIR application then the interaction with the API using HTTP Requests.
Following code shows how to perform a URL request from the Adobe Website.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html
var url:String = url location of the API;
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables(); //create variables to pass to the API
variables.exampleSessionId = new Date().getTime(); //create variables to pass to the API
variables.exampleUserLabel = "guest"; //create variables to pass to the API
request.data = variables; //Add the variables to the request
request.method = URLRequestMethod.POST; //Set the method of the Request GET, POST, PUT
navigateToURL(request); //Executes the request
You'd probably like something like https://backendless.com/ for this.
I'm developing a Windows Phone 8 app that uses Raw Notification. For this, I'm following the sample "How to send and receive raw notifications for Windows Phone 8".
I coded exactly as the sample:
public MainPage()
{
/// Holds the push channel that is created or found.
HttpNotificationChannel pushChannel;
// The name of our push channel.
string channelName = "RawSampleChannel";
InitializeComponent();
// Try to find the push channel.
pushChannel = HttpNotificationChannel.Find(channelName);
// If the channel was not found, then create a new connection to the push service.
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(PushChannel_HttpNotificationReceived);
pushChannel.Open();
}
else
{
// The channel was already open, so just register for all the events.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(PushChannel_HttpNotificationReceived);
// Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString());
MessageBox.Show(String.Format("Channel Uri is {0}",
pushChannel.ChannelUri.ToString()));
}
}
After I ran the code in a device, I saw that the app is generating a different URI each time I launch it.
I realized that HttpNotificationChannel.Find(channelName) is always returning null (that's why the app is always generating a new URI).
I already read this, but still didn't help me.
So, my question is:
Shouldn't HttpNotificationChannel.Find(channelName) returns something different from 'null' if the app had already generated a channel?
If I missed something that could help, please tell me.
I went through your post and the mentioned links. It seems channelUri updation is pretty random (usually it would certainly change for app uninstall/install, but there maybe other scenarios as well). One sure-shot way of ensuring your users are targeted properly is to associate the channelUri with another unique identifier. For instance, after grabbing the channelUri you might want to update the server database with the uri and a unique user id. For subsequest calls, only the channel may be updated for the same user. Hope this helps a bit.
Following is the code for WP8 push notification.
HttpNotificationChannel pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive the notifications while your application is running.
pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
pushChannel.Open();
// Bind this new channel for toast events.
pushChannel.BindToShellToast();
pushChannel.BindToShellTile();
As you can see in above code I am binding pushChannel to shellToast as well as shellTile. I want to know is it valid or not? since I haven't got any doc on msdn regarding this. If it is possible and server sends any of the notifications will it be shown properly?
Please give your valuable feedback on this.
It is possible and it is the right way to do it. One app, one channel, no matter how many kinds of push notifications you use.