Re-Launch App from Background Service - titanium-mobile

I am writing an App in Titanium Studio and I'm having a problem with opening my app from it's own background service. Any help would be greatly appreciated.
I tried way too many variations to put them all in one question but I hope this gives an idea of what I've tried from answers to similar problems here on stackoverflow and examples from the Titanium Studio Documentation:
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_RUN,
type: "text/plain",
className: "index.js",
packageName: "com.jason.avenue"
});
intent.putExtra(Ti.Android.EXTRA_TEXT, 'Arrived');
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
Ti.Android.currentActivity.startActivity(intent);
That throws the error "cannot start activity of null" I assume because I can't get the currentActivity of a background service but I really don't know.
I would like to open my app, after it has been closed by the user, from the background service that my app created before it was closed. If anyone has done this and would be so gracious as to share a snippet of how, I will write you into my will. :)
Thank you very much for taking the time to read my question.

you are putting wrong value in className
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_RUN,
type: "text/plain",
url: "index.js",
className: "com.jason.avenue",
packageName: "com.json.avenue.IndexServices"
});
packageName you can get it when you look into your build > android > AndroidManifest.xml
Good Luck :)

Related

Failed to connect (500) to bot framework using Direct Line

We have a bot running in Azure (Web App Bot) that I'm trying to embed on a website. The bot is based of the Bot Builder V4 SDK Tamplate CoreBot v4.9.2. At first I used the iframe to embed the bod. This worked but didn't provide the features we need, so now im changing it to use DirectLine.
My code on the webpage looks like this:
<script crossorigin="anonymous"
src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<div id="webchat" role="main"></div>
<script>
(async function () {
const res = await fetch('https://[my bot name here].azurewebsites.net/.bot/v3/directline/tokens/generate',
{
method: 'POST',
headers: new Headers({
'Authorization': "Bearer [my token here]"
})
});
const { token } = await res.json();
window.WebChat.renderWebChat(
{
directLine: await window.WebChat.createDirectLineAppServiceExtension({
domain: 'https://[my bot name here].azurewebsites.net/.bot/v3/directline',
token
})
},
document.getElementById('webchat')
);
document.querySelector('#webchat > *').focus();
})().catch(err => console.error(err));
</script>
After some struggles I managed to fetch a token from https://[my bot name here].azurewebsites.net/.bot/v3/directline.
And I can see the chat window on my webpage, but is says connecting for a while then it changes to Taking longer than usual to connect, like this:
In the Chrome console there is an error saying Failed to connect Error: Connection response code 500. When I check Chrome's Network tab I can see that the token generated completed with status 200 and that the websocket connection is open, like this:
----------EDIT---------
I just noticed that when go to https://[my bot name here].azurewebsites.net/.bot using a webbrowser, the resulting json is
{"v":"1.0.0.0.55fa54091a[some key?]","k":true,"ib":false,"ob":false,"initialized":true}
ib and ob should be true but are false, maybe this is part of the problem.
----------EDIT 2---------
OK so now I'm starting to go crazy.
Ashish helped me and at some point the ib and ob were true. They were true for most of yesterday. At some point yesterday they turned false for a short while (no more than 2 hours). I checked if someone had triggered the release pipeline but no recent releases. After that ib and ob magically turned true again and connecting to the direct line worked again.
Now this morning ib and ob were false again. And again no recent releases. I don't know what is causing this.
Does anybody know what's going on here or how to fix this? How do I find what causes ib and ob to be false?
Any help is appreciated! Thanks in advance. If you need more information, just ask and I'll post it.
If the ib and ob values displayed by the *.bot endpoint are false this means the bot and the Direct Line app service extension are unable to connect to each other.
Make sure you verify below things:
Double check the code for using named pipes has been added to the
bot.
Confirm the bot is able to start up and run at all. Useful
tools are Test in WebChat, connecting an additional channel, remote
debugging, or logging.
Restart the entire Azure App Service the bot
is hosted within, to ensure a clean start up of all processes.
Please check troubleshooting guide, it seems updated today. (still old date reflected some how, not sure why)

MSTeams Development: navigate between personal tabs

sdk version: https://statics.teams.cdn.office.net/sdk/v1.6.0/js/MicrosoftTeams.min.js
How do you Navigate between 2 personal tabs?
Currently i am running this, but it does not seem to work. In-fact it seems like its doing nothing.
microsoftTeams.navigateToTab({
tabName: 'Calendar',
entityId: '<guid comes here>',
url: 'https://<domain-comes-here>/tab-auth'
});
Am i missing some parameters? or am i doing it completely wrong?
Update
I managed to get it to work with by Generating a deep link to my tab
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links#deep-linking-to-your-tab
So in my case all I had todo was add the following.
microsoftTeams.executeDeepLink("https://teams.microsoft.com/l/entity/<appId>/<entityId>");
Even tho this works I would still like to know why the microsoftTeams.navigateToTabdoes not work?

UWP code : using "await" in "Dispatcher"

await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High,async () =>
{
await MainPage.bmpsource.SetBitmapAsync(bmp);
});
I putted codes in while loop .When I click button or some controls on running app,the app will crash and pinpoint on code "await MainPage.bmpsource.SetBitmapAsync(bmp);".
VS output:
there will be an exception of type 'System.Threading.Tasks.TaskCanceledException' occurred in System.Private.CoreLib.ni.dll but was not handled in user code
A task was canceled.
Maybe someone can help me,thank you!
You should not use CoreDispatcherPriority.High as that can cause issues (and may be causing this issue).
Please check the link above for more information on this matter.

apiKey key ID and secret is required even though they're there in express-stormpath

I'm trying to use express-stormpath on my Heroku app. I'm following the docs here, and my code is super simple:
var express = require('express');
var app = express();
var stormpath = require('express-stormpath');
app.use(stormpath.init(app, {
website: true
}));
app.on('stormpath.ready', function() {
app.listen(3000);
});
I've already looked at this question and followed the Heroku devcenter docs. The docs say that for an Heroku app, it's not necessary to pass in options, but I've still tried passing in options and nothing works. For example, I've tried this:
app.use(stormpath.init(app, {
// client: {
// file: './xxx.properties'
// },
client: {
apiKey: {
file: './xxx.properties',
id: process.env.STORMPATH_API_KEY_ID || 'xxx',
secret: process.env.STORMPATH_API_KEY_SECRET || 'xxx'
}
},
application: {
href: 'https://api.stormpath.com/v1/applications/blah'
},
}));
To try and see what's going on, I added a console.log line to the stormpath-config strategy valdiator to print the client object, and it gives me this:
{ file: './apiKey-xxx.properties',
id: 'xxx',
secret: 'xxx' }
{ file: null, id: null, secret: null }
Error: API key ID and secret is required.
Why is it getting called twice, and the second time around, why does the client object have null values for the file, id and secret?
When I run heroku config | grep STORMPATH, I get
STORMPATH_API_KEY_ID: xxxx
STORMPATH_API_KEY_SECRET: xxxx
STORMPATH_URL: https://api.stormpath.com/v1/applications/[myappurl]
I'm the original author of the express-stormpath library, and also wrote the Heroku documentation for Stormpath.
This is 100% my fault, and is a documentation / configuration bug on Stormpath's side of things.
Back in the day, all of our libraries looked for several environment variables by default:
STORMPATH_URL (your Application URL)
STORMPATH_API_KEY_ID
STORMPATH_API_KEY_SECRET
However, a while ago, we started upgrading our libraries, and realized that we wanted to go with a more standard approach across all of our supported languages / frameworks / etc. In order to make things more explicit, we essentially renamed the variables we look for by default, to:
STORMPATH_APPLICATION_HREF
STORMPATH_CLIENT_APIKEY_ID
STORMPATH_CLIENT_APIKEY_SECRET
Unfortunately, we did not yet update our Heroku integration or documentation to reflect these changes, which is why you just ran into this nasty issue.
I just submitted a ticket to our Engineering team to fix the names of the variables that our Heroku addon provisions by default to include our new ones, and I'm going to be updating our Heroku documentation later this afternoon to fix this for anyone else in the future.
I'm sincerely sorry about all the confusion / frustration. Sometimes these things slip through the cracks, and experiences like this make me realize we need better testing in place to catch this stuff earlier.
I'll be working on some changes internally to make sure we have a better process around rolling out updates like this one.
If you want a free Stormpath t-shirt, hit me up and I'll get one shipped out to you as a small way to say 'thanks' for putting up with the annoyance: randall#stormpath.com
After endless hours, I managed to finally get it working by removing the add-on entirely and re-installing it via the Heroku CLI and then exporting variables STORMPATH_CLIENT_APIKEY_ID and STORMPATH_CLIENT_APIKEY_SECRET. For some reason, installing it via the Heroku Dashboard causes express-stormpath to not find the apiKey and secret fields (even if you export variables).

parsr.com - Connection can not be established

I use the datastore of parse.com to manage the data of my apps. I use javascript by the way. I establish my connection like this:
Parse.initialize("KRCjl8ZEgNIERgXcbhbh6kfsdeXReWfA9phOY1Ql","v5uW61qzYboq64zleielyi9876sx8se");
// A Collection containing all instances of category objects.
var categoryObject = Parse.Object.extend("categories");
var CategoryCollection = Parse.Collection.extend({
model: categoryObject
});
var collection = new CategoryCollection();
collection.fetch({
success: function(categoryList) {
alert("ok");
},
error: function(collection, error) {
for(item in error) {
alert(item +" = "+ error[item]);
}
}
});
The thing is that it worked yesterday, now when I browse to www.parse.com, it says that the certificate has expired. I think it has something to do with this issue.
Can anyone tell me please what I could do now.
Thanks,
enne
We had an SSL issue this morning that caused downtime. You can read our post-mortem here: http://blog.parse.com/2012/09/10/summary-of-the-september-10-parse-service-disruption/.
The issue was resolved this morning at 8:42am and everything should be working fine now.
If you have any other issues with Parse, feel free to check out parse.com/help
If you hit parse.com, you'll get an expired SSL cert error. That's why the API calls aren't working, same thing happening for my app. I can't imagine this happening in a professional context, but there it is. I've sent a message to support. Strangely, my tweet didn't show up on #ParseIt.
Same thing is happening for me. I don't think is your code - probably a problem on their site. Hopefully it'll get resolved soon.
Parse.com is still a buggy system but you can access your data through web interface like
https://www.parse.com/apps/ispect/collections#class/
Mention you and can access to your data.

Resources