English 中文(简体)
如何在我的申请的背景中树立流行的形象?
原标题:How to create popup image on top of other applications, while my application is running in the background?
  • 时间:2011-11-24 12:28:55
  •  标签:
  • android
  • ads

我有一份安乐施会的申请,在某个阶段由 back接,一旦发生一些事件,它就接手,并出现在地下。

now I want something more complex. when my activity is in the background, show small image at the bottom of the screen (like a popup ad), no matter what application is running. is this possible? (it s not the case of writing application, and letting ads engine to insert ads into my application. I want kind of opposite, without any integration)

问题回答

和Jan一样,你应当非常谨慎,因为如果得不到适当处理,它就能够很容易地使用户感到不快。 这里是表明观点超支的一种方式。 您需要电话的所有人明确准许您超期批准。 然后,你可以从一个服务类别中发表意见。 你需要记住正确处理这些许可。 您需要明确表明以下允许:

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

由于这是一种危险的许可,使用者必须在环境中人工准许。 然后,你可以与窗口经理合作,处理意见一致、规模和细节问题。 例如:

windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
        params = WindowManager.LayoutParams(
                WindowManager.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_PHONE,
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                PixelFormat.TRANSLUCENT)

        params.gravity = Gravity.BOTTOM
        if (view.windowToken != null) {
          try {
            windowManager!!.addView(view, params)
        } catch (e: Exception) {
            Log.d("The exception is", e.toString())
        }

        } 

你可以这样做,但是,这在很大程度上违背了安康本身的设计原则,人们会立即取消你的用意。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签