# Can't get Tasker plugin fully functional



## SkullOne (Jul 9, 2011)

Greetings,

I have been working on adding Tasker/Locale support to my app. The plugin will allow Tasker to set the profiles in the app based on whatever the user wants (location/time/etc). I have it partially functional but I can't see where I've gone wrong.

The app has the ability to support up to 6 different profiles. Right now Tasker will only apply the first profile no matter which profile has been selected. I assume the issue resides here:

https://github.com/s...ivity.java#L103

The "i" variable doesn't seem to ever get changed before it's passed. It always passes "0". The EXTRA_STRING_BLURB below it correctly passes it's "profile" variable. So I'm confused as to why one variable is fine but the other is screwed up. It should be mentioned that Tasker itself uses the Blurb and not my app directly.

The integer is used here:

https://github.com/s...ceiver.java#L66

The way the code is right now in FireReceiver.java I always get the 0. If I use getString() and try to parseInt I get a NullPointerExeception. Different iterations of passing the variable through intent yields the same issue(s) which is why I'm so lost.

Any help pointing me in the direction of what I'm doing wrong would be greatly appreciated!


----------



## JBirdVegas (Jun 11, 2011)

SkullOne said:


> Greetings,
> 
> I have been working on adding Tasker/Locale support to my app. The plugin will allow Tasker to set the profiles in the app based on whatever the user wants (location/time/etc). I have it partially functional but I can't see where I've gone wrong.
> 
> ...


Line 98 add some logging to see what I is there. Also don't finish() everywhere. And instead of using several if {} if {} if {} use if else {} if else {} else {} then finish at the end. It will be faster.

My guess is your not setting i in the on click. Add some logging so you can see if your setting the var

Also bad ass I didn't know tasked allowed anything like this.


----------



## SkullOne (Jul 9, 2011)

JBirdVegas said:


> Line 98 add some logging to see what I is there. Also don't finish() everywhere. And instead of using several if {} if {} if {} use if else {} if else {} else {} then finish at the end. It will be faster.
> 
> My guess is your not setting i in the on click. Add some logging so you can see if your setting the var
> 
> Also bad ass I didn't know tasked allowed anything like this.


Well I feel* very* foolish. Guess i was just looking at the code for far too long trying to fix something easy and thinking it was complicated. I had used some logging earlier but it didn't tell me much because I somehow missed the ClassCastException error. -.- /sigh

I was so focused on trying to get it to work on that specific bundle I wasn't paying attention. So I did it the simple way and passed it normally through intent. No more ClassCastExeception. Everything working correctly. Tasker now swaps all the profiles correctly.

I also corrected the finish(); issue you brought up. 
Thanks for the help!


----------



## yarly (Jun 22, 2011)

It's always something simple one is looking too hard for that ends up being the fix.


----------

