Floating App Success!

bitstra

Member
Licensed User
Longtime User
I've play'd around with @agraham's Reflection Library and android.WindowManager.LayoutParams...

to find a workaround for making floating apps without the use of StandOut.

I had partial success :

I'm using two activities in my test-app; both with transparent activity background and a panel, containing a Label for test messages...
A service with notification intent for starting the app in any screen-view.
But any view-type can be used there, imageviews, buttons, canvas etc.(!)...
The app uses
B4X:
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
to can be overlayed to any running app...

I tested some combinations of setting Window Flags via Reflection Library.
The result is is a useable workaround for easy making floating apps with b4a.

The only issue i had, I can't figure out how wie can get a MotionEvent.ACTION_OUTSIDE
via agrahams Reflection library. So I will try to make an own small library for doing that.
For the moment we can make:
-the app floating over other apps
-on touch_up event in the firs activity Main let the floating app be docked
with the second activity, to can do actions in the underlaying apps.

-on tap Back-Button make with the first activity the app floating (moveable) again - and so on...

You can try my sample-Floater-project, attached here. And you can use the code for your own projects!

Any ideas for improving this project are welcome.

@agraham: is it possible to extend the reflection library's ontouch_listener with motion/touch_event.ACTION_OUTSIDE ? Then we could have real floating apps. - Moving/Docking without the workaround via Hardware-Button-focussed events...
 

Attachments

  • Floater V0.1.zip
    16.6 KB · Views: 734
  • Screenshot_2013-05-24-23-00-24.png
    Screenshot_2013-05-24-23-00-24.png
    15.4 KB · Views: 699
  • Screenshot_2013-05-24-23-02-47.png
    Screenshot_2013-05-24-23-02-47.png
    18.4 KB · Views: 652
Last edited:

NJDude

Expert
Licensed User
Longtime User
Very nice, however, is not really like StandOut, because when the "floating app" is running you cannot use the one in the background, also, if you have an app in full screen, the floating app doesn't work.

Very cool anyway.
 
Last edited:
Upvote 0

bitstra

Member
Licensed User
Longtime User
Very nice, however, is not really like StandOut, because when the "floating up" is running you cannot use the one in the background, also, if you have an app in full screen, the floating app doesn't work.

Very cool anyway.

If the app is docked (the second Activity active), then I can use the underlaying app (tested with this attached sample project and all my installed apps) :)
In docked state a timer tickers messages into Label - and underlaying app is also useable...

Give it a try - or look into the code - it's really working!
 
Last edited:
Upvote 0

NJDude

Expert
Licensed User
Longtime User
I can click on the apps in the back, it works for me!

It somewhat works, I have an app running in the background, click on a button and displays an InputList, I can scroll the InputList (sort of) but CANNOT click on the items, other times I cannot click on the buttons.
 
Last edited:
Upvote 0

bitstra

Member
Licensed User
Longtime User
witch android version are you running.

I've tested it only with Paranoid Android 3.5+ OS 4.2.2; Nexus 4 and B&N Nook Color...
 
Upvote 0

bitstra

Member
Licensed User
Longtime User
May be, you can try another targetAPI version counter in Manifest-Editor ?
My sample project uses:
B4X:
<uses-sdk android:minSdkVersion="8" android:maxSdkVersion="17" android:targetSdkVersion="17" />

but indeed, the current state is experimental!
 
Last edited:
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Same thing here. even if I do this:
B4X:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
Same issue.

Don't get me wrong, this is very cool, just reporting the problems and issues I found.
 
Upvote 0

bitstra

Member
Licensed User
Longtime User
... understood your postings in this sense.
going into hospital next monday, so I will have much time for coding a useful lib to make it better :)

All comments and issue reportings are welcome...
 
Upvote 0

intera

Member
Licensed User
Longtime User
strange behaviour

Hi, thanks for sharing this, however I notice that its behaviour is diferent in 2.6.3 than in 4.2.2

in 2.6.3 the background is rubbish(not really dimmed I would say) but you touch the background and interact with it, althoughu no posible to lanch any app(just the application ico ?¿?¿?) the rest yo can click on them but they do not open....anyways do not really care for 2.6.3

in 4.2.2 however as soon as i click on the background or any app the demo app get paused (or closed) and next click now works ok(but of course your demo panel is not working any more....)
in the log file I see something like this:


Input event: value=0
Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=18116177301000
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1 [
Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 6 mFalseSizeCnt:0 onReceive [android.intent.action.ACTIVITY_STATE/de.esolutions4you.floatlaunch/pause] mDVFSHelper.acquire() ContainerPolicy Service is not yet ready!!! ContainerId: 0
log() is called by non admin
setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0
setHoveringSpenCustomIcon IconType is same.1
Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1323 com.android.server.am.ActivityManagerService.computeOomAdjLocked:14825 com.android.server.am.ActivityManagerService.computeOomAdjLocked:14485 com.android.server.am.ActivityManagerService.updateOomAdjLocked:15116 com.android.server.am.ActivityManagerService.updateOomAdjLocked:15311 Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1323 com.android.server.am.ActivityManagerService.computeOomAdjLocked:14831
com.android.server.am.ActivityManagerService.computeOomAdjLocked:14485 com.android.server.am.ActivityManagerService.updateOomAdjLocked:15116 com.android.server.am.ActivityManagerService.updateOomAdjLocked:15311 Window{430b8558 u0 Keyguard}mOrientationRequetedFromKeyguard=false computeScreenConfigurationLocked() set config.orientation=1 dw=1080 dh=1920 Callers=com.android.server.wm.WindowManagerService.updateOrientationFromAppTokensLocked:5153 com.android.server.wm.WindowManagerService.updateOrientationFromAppTokens:5122 com.android.server.am.ActivityStack.resumeTopActivityLocked:2597 Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1323 com.android.server.InputMethodManagerService$5.run:2283 java.lang.Thread.run:856 <bottom of call stack> <bottom of call stack> setKeyboardVisibility: false Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1337 com.android.server.am.ActivityStack.resumeTopActivityLocked:2661 com.android.server.am.ActivityStack.resumeTopActivityLocked:2194 com.android.server.am.ActivityStack.resumeTopActivityLocked:2180 com.android.server.am.ActivityStack.completePauseLocked:1648 [api] userActivity : event: 0 flags: 0 (uid: 1000 pid: 779) [api] release WakeLock flags=0x2000000a tag=WindowManager uid=1000 pid=779 (0x0) Window{430b8558 u0 Keyguard}mOrientationRequetedFromKeyguard=false onResume, Launcher: 1145655592 onResume onReceive [android.intent.action.ACTIVITY_STATE/com.sec.android.app.launcher/resume] num online cores: 1 reqd : 3 available : 4 rq_depth:8.800000 hotplug_avg_load_dw: 44 UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:146.000000 UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:146.000000 proc in:com.google.android.apps.plus,adj=15LRU num=85,i=41 proc in:com.sec.android.gallery3d,adj=15LRU num=85,i=40 onResume



any tip to make it in work on 4.2.2?

thanks in advanced


EDIT:

well playing with the flags and the manifest editor but still no luck....not posible to touch the background when the panel is on scree...

I will have to learn refelection and all the flags.....

Just in case anybody can help this is what I found:

1º)all the FLAGS: http://developer.android.com/refere...er.LayoutParams.html#FIRST_APPLICATION_WINDOW
however it looks that they dont work as espected.....

2º)the refelection lib.... http://www.b4x.com/android/help/reflection.html


well will keep searching..
 
Last edited:
Upvote 0

xiaoyao

Member
Licensed User
Longtime User
can it be best?
I've play'd around with @agraham's Reflection Library and android.WindowManager.LayoutParams...

to find a workaround for making floating apps without the use of StandOut.

I had partial success :

I'm using two activities in my test-app; both with transparent activity background and a panel, containing a Label for test messages...
A service with notification intent for starting the app in any screen-view.
But any view-type can be used there, imageviews, buttons, canvas etc.(!)...
The app uses
B4X:
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
to can be overlayed to any running app...

I tested some combinations of setting Window Flags via Reflection Library.
The result is is a useable workaround for easy making floating apps with b4a.

The only issue i had, I can't figure out how wie can get a MotionEvent.ACTION_OUTSIDE
via agrahams Reflection library. So I will try to make an own small library for doing that.
For the moment we can make:
-the app floating over other apps
-on touch_up event in the firs activity Main let the floating app be docked
with the second activity, to can do actions in the underlaying apps.

-on tap Back-Button make with the first activity the app floating (moveable) again - and so on...

You can try my sample-Floater-project, attached here. And you can use the code for your own projects!

Any ideas for improving this project are welcome.

@agraham: is it possible to extend the reflection library's ontouch_listener with motion/touch_event.ACTION_OUTSIDE ? Then we could have real floating apps. - Moving/Docking without the workaround via Hardware-Button-focussed events...
 
Upvote 0
Top