[Q] trying to finish activity from a widget - Java for Android App Development

Hi,
I have a small problem..
In my app I have activity A and activity B. A is the main activity..
when working in normal state, A is opened, I can call B and return to A and everything is OK.
Also I have a widget that all it does is to call activity B or to finish activity B.
my problem is that if A is running at the background and I pressed the widget to call B and then, again to turn off B
A is suddenly appears on screen..
I'm trying to turn off A when B is turned off from the widget (using intent) without a success
when A resumed is getting a whole different intent from what I've sent..
can anyone please help..???

Related

HTC Task Manager

Just as background, I just started using HTC Home + Customizer, HTC Task Manager:
When I open text messages by clicking on the icon with the "1" it'll open up. I click the message. Then click "OK." to go back Sometimes it will close the entire program, instead of closing back to the Inbox, without even registering that I read the message. Anyone know / have this same problem?
Similarly, and this is more just relating to the first problem. When I tried to change the settings for Solitaire to be "1" card instead of "3", everytime it would completely close out the application back to the Games folder. And thus, not saving the setting.
I'm just trying to figure out how to get the X button and the Ok button to play nice.

Tap outside activity to return back

hello exists a method/way to make sure that doing a tap outside activity returns back (previous activity)?
thanks

Problem with scheduled tasks

I have a rooted Nexus 7 (JOP40D) and am having problems with scheduled tasks not executing:
1. A Tasker (v1.09) profile scheduled to run at a specific time does not execute, even though it works fine in Test mode. I did notice that there is no green light on the "On" button in Tasker (this turned green on my old tablet when Tasker was switched on, but doesn't on the Nexus). The Tasker icon does show in the Notification bar though.
2. Beyondpod does not do its scheduled daily updated of my feeds.
Has anyone else had problems with scheduled tasks?
I've just noticed that the correct Profile name appears in the notification bar when it becomes active, but the actions don't execute (turn on screen, open bookmark, start Beyondpod Smartplay, etc)

Create a home launcher and call another home launcher

Hi everybody. I'm not sure if this is the right forum for asking this.
I'm developing an app that behaves like a kiosk mode, so I have a variable that indicates if I'm on kiosk mode or "normal mode". I have an Activity registered as category.HOME, which manages what should the app do, depending on the "kiosk mode" variable.
Manifest sample:
Code:
<activity
android:name="com.stuff.kiosklauncher.MainActivity"
android:exported="false"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:stateNotNeeded="true" >
<!-- This tag indicates the initial activity -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
If I press the Home button on my Android phone, my MainActivity is called, and there if we are in kiosk mode, I do nothing, but if I I have the kiosk mode set to off, I look for the preferred launcher (stored in a variable called defaultlauncher), and call it at the onResume() with:
Code:
if(!kioskMode){
Intent startApp = new Intent();
ComponentName component = new ComponentName(
defaultLauncher.getPackageName(),
defaultLauncher.getClassName());
startApp.setComponent(component);
startApp.addCategory(Intent.CATEGORY_HOME);
startApp.setAction(Intent.ACTION_MAIN);
startActivity(startApp);
}
Seems to work ok, but it has some issues, as the "standard" launcher doesn't behave as it should (it doesn't scroll back to the main page when I'm on the desktop, for example... or flicks a little like trying to load my app's layout when pressing continuously the home button). So I'm not sure if I'm doing this right, maybe an Activity shouldn't be the place to lad or not the launcher, but I don't know if I can make a service or a broadcast receiver to be called when the home button is pressed.
I've seen a lot of apps that behave this way (like a launcher on top of another one), but I don't know how they do it.
Again, sorry if this is not the place to seek this kind of help, if that's the case, I'd love to know where should I go. If this is the place, please help. Thanks!
I think that you will not be able to start a service or broadcast receiver.
One idea (I do not know whether it works): Try overriding the onKeyDown and onKeyUp methods for the home button and return true.
Look at this: http://stackoverflow.com/questions/2079691/overriding-the-home-button-how-do-i-get-rid-of-the-choice (especially the second answer)
Thanks, I'll take a look to that!
I had made a kiosk browser app, and it worked perfectly.
My trick was using <activity-alias> tag, as well as some notifications to user mention that, they must select the app as default home launcher if they were in "kiosk" mode.
Moon.lSd said:
I had made a kiosk browser app, and it worked perfectly.
My trick was using <activity-alias> tag, as well as some notifications to user mention that, they must select the app as default home launcher if they were in "kiosk" mode.
Click to expand...
Click to collapse
In your kiosk mode, you had some way to "exit" from it without forcing the user to change the launcher? This would be exactly what I'm trying to achieve, could you provide a little more info? I'm not sure how I could use <activity-alias> here :/
Thanks
pnikosis said:
In your kiosk mode, you had some way to "exit" from it without forcing the user to change the launcher? This would be exactly what I'm trying to achieve, could you provide a little more info? I'm not sure how I could use <activity-alias> here :/
Thanks
Click to expand...
Click to collapse
Well, you can't change an activity intent filter, so you are unable to make a activity from launcher to non-launcher.
But if you are using activity-alias instead of activity, you can disable or enable intent filter of that alias, and thus, by using a shortcut key (like press back 5 times continously), you can exit kiosk mode, disable filter of the alias and default launcher will be automatically called without ask user to do that.
FYI: <activitiy-alias> is a tag in AndroidManifest, just like <activity>, but if <activity> points to a real Activity class, <activity-alias> point to another <activity> tag.
Moon.lSd said:
Well, you can't change an activity intent filter, so you are unable to make a activity from launcher to non-launcher.
But if you are using activity-alias instead of activity, you can disable or enable intent filter of that alias, and thus, by using a shortcut key (like press back 5 times continously), you can exit kiosk mode, disable filter of the alias and default launcher will be automatically called without ask user to do that.
FYI: <activitiy-alias> is a tag in AndroidManifest, just like <activity>, but if <activity> points to a real Activity class, <activity-alias> point to another <activity> tag.
Click to expand...
Click to collapse
Thanks! I'll take a look to that solution, I think I'm getting the idea.
what you can do is get the default launcher as soon as installing the app and store it locally then when the user fires your launcher activity just do what you want to and fire up the home intent directed to the package of previous default launcher this should do it .
If you are doing some heavy duty work then launch a service from the activity and dump your work there this i guess should do it
sak-venom1997 said:
what you can do is get the default launcher as soon as installing the app and store it locally then when the user fires your launcher activity just do what you want to and fire up the home intent directed to the package of previous default launcher this should do it .
If you are doing some heavy duty work then launch a service from the activity and dump your work there this i guess should do it
Click to expand...
Click to collapse
Thanks!
A quick question though, what do you mean by dumping the work in a service? I don't understand completely why and how should I do that.
My first approach was indeed, once I launch my app look for the current default launcher. I even added an option in my app in case the user wants to change the "regular" launcher (looking for the installed packages with the ACTIVITY_HOME filter). The problem is, when I call the intent to the previous launcher, it works ok but not completely. For example, if I'm on the "regular" desktop and I call the home button, it should display the desktop thumbails, or go back to the default desktop, but instead of that, it does nothing (a quick flicker sometimes, I guess because its calling again the activity).
pnikosis said:
Thanks!
A quick question though, what do you mean by dumping the work in a service? I don't understand completely why and how should I do that.
My first approach was indeed, once I launch my app look for the current default launcher. I even added an option in my app in case the user wants to change the "regular" launcher (looking for the installed packages with the ACTIVITY_HOME filter). The problem is, when I call the intent to the previous launcher, it works ok but not completely. For example, if I'm on the "regular" desktop and I call the home button, it should display the desktop thumbails, or go back to the default desktop, but instead of that, it does nothing (a quick flicker sometimes, I guess because its calling again the activity).
Click to expand...
Click to collapse
Working in activities is not proffered as it causes lag on low activity devices
Flickr is probably due the reason you gave that it's being called again and again from the activity
Sent from my GT-S5302 using Tapatalk 2
Hit Thanx Button if i helped you!
sak-venom1997 said:
Working in activities is not proffered as it causes lag on low activity devices
Flickr is probably due the reason you gave that it's being called again and again from the activity
Sent from my GT-S5302 using Tapatalk 2
Hit Thanx Button if i helped you!
Click to expand...
Click to collapse
I see. I think I have an idea on how I can approach this. Thank you all guys, lots of great ideas, you helped me a lot. Sorry I can hit the thanks button only once per message

[Q] Wechat gets shut down when clearing apps

I'm not sure if it's a launcher issue. I'm usin nova launcher on an unrooted Note 3 and am an avid WeChat user.
On my note 2 whenever I clear all background apps via battery doctor or long pressing the home button and manually removing WeChat i will still receive new wechat messages.
However on my note 3 whenever i long press the home button and click on the bottom right icon on the screen i cease to receive new wechat message until i run the app again.
Is there a way i can make wechat run persistently in the background like whatsapp?
Anyone has any idea?
bumping it up for a solution.

Categories

Resources